ios – NSUserDefaults日志中的错误
发布时间:2020-12-15 01:55:15 所属栏目:百科 来源:网络整理
导读:我在日志中收到一些错误消息 [User Defaults] Failed to write value for key GameId in CFPrefsPlistSource0x1740faf00 (Domain: xxx.xxxxxx,User: kCFPreferencesCurrentUser,ByHost: No,Container: (null)): Path not accessible,switching to read-only[
我在日志中收到一些错误消息
[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,Container: (null)) 是什么原因造成的? 这就是我使用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]; } 解决方法
很多人在Xcode 8上发现了这个问题。
“因为听起来很疯狂,尝试重新启动手机和主机,有时Xcode可能会因为理由而被卡住,只有重启有帮助。 使用Xcode 8.1 Beta构建,您将看到相同的警告,但您也将获得该值。 “ 参考:https://forums.developer.apple.com/thread/51348 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- reactjs – 如何使用react native在TabNavigation下的页脚文
- [转帖]盖国强:Oracle 路线图
- ruby-on-rails – 我们是否需要在用户注销后删除会话变量?
- ruby – 为什么ENV表现得像哈希,但它是一个Object类
- 使用@Configuration_@Bean_@Import简化xml配置
- c# – 如何使用CertEnroll生成扩展验证自签名证书?
- Cocos2d-x 3.4 之 文本输入之 EditBox
- [沫沫金]软件单一功能点,说明书编写模板
- ruby – 如何使用FactoryBot定义嵌套工厂?
- 等级相关系数 Coefficient Of Rank Correlation