Val*_*din 21 xcode objective-c nsuserdefaults ios
我在日志中收到一些错误消息
[User Defaults] Failed to write value for key GameId in CFPrefsPlistSource<0x1740faf00> (Domain: xxx.xxxxxx, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): Path not accessible, switching to read-only
[User Defaults] attempt to set <private> for key in <private> in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1740faf00> (Domain: xxx.xxxxxx, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null))
Run Code Online (Sandbox Code Playgroud)
是什么导致这个?
这就是我的用法NSUserDefaults:
- (NSString *)gameId
{
if (_gameId)
return _gameId;
_gameId = [[NSUserDefaults standardUserDefaults] objectForKey:@"GameId"];
return _gameId;
}
- (void)setGameId:(NSString *)aGameId
{
_gameId = aGameId;
[[NSUserDefaults standardUserDefaults] setObject:_gameId forKey:@"GameId"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
Run Code Online (Sandbox Code Playgroud)
Tus*_*har 30
很多人在Xcode 8上发现了这个问题.
"虽然听起来很疯狂,但尝试重新启动手机和主机,有时Xcode会因为总和原因而卡住,只有重新启动有帮助.
使用Xcode 8.1 Beta构建,您将看到相同的警告,但您也将获得该值."
参考:https://forums.developer.apple.com/thread/51348
| 归档时间: |
|
| 查看次数: |
11451 次 |
| 最近记录: |