/** 清除userDefaults所有数据*/
func clearAllUserDefaultsData(){ let userDefaults = UserDefaults.standard let dics = userDefaults.dictionaryRepresentation() for key in dics { userDefaults.removeObject(forKey: key.key) } userDefaults.synchronize() }
原文链接:https://www.f2er.com/swift/321530.html