Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSUserDefaults errors in logs

Tags:

I get some error messages in logs

[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 for key in in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1740faf00> (Domain: xxx.xxxxxx, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null))

What does cause this?

That's how I use 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]; } 
like image 345
Valentin Shamardin Avatar asked Oct 05 '16 13:10

Valentin Shamardin


1 Answers

Lot of people are finding this issue on Xcode 8.

"As crazy as it sounds try rebooting phone and host, sometimes Xcode can get stuck for sum reason only restart helps.

build with Xcode 8.1 Beta and you will see the same warning, but you will also get the value. "

reference : https://forums.developer.apple.com/thread/51348

like image 89
Tushar Avatar answered Sep 20 '22 17:09

Tushar