无法在沙盒应用中读取和写入Userdefaults

时间:2017-12-29 18:49:34

标签: swift cocoa nsuserdefaults sandbox

我沙箱了我的应用程序,从那时起我收到以下错误:

2017-12-29 19:31:19.649922+0100 Testapp[74854:12059315] [User Defaults] Failed
to read values in CFPrefsPlistSource<0x6080000e0080> (Domain: testapp, User:
kCFPreferencesCurrentUser, ByHost: No, Container: (null)): accessing preferences
outside an application's container requires user-preference-read or file-read-data sandbox access, detaching from cfprefsd

2017-12-29 19:31:19.893912+0100 Testapp[74854:12059315] [User Defaults] attempt to
set 100 for key in numberOfResults in non-persistent preferences domain
CFPrefsPlistSource<0x6080000e0080> (Domain: testapp, User:
kCFPreferencesCurrentUser, ByHost: No, Container: (null))

我正在设置Userdefaults就像这样;

UserDefaults.standard.set(true, forKey: "NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints")

知道我错过了什么吗?

0 个答案:

没有答案