0

since iOS 10 (with iOS 9 everything was ok) i have an problem with the NSUserDefaults. I already asked Google, but didn't get a solution for this.

When i want to save something to userDefaults sometimes this code appears and everything after that will not be saved:

"[User Defaults] Failed to write value for key xxx in CFPrefsPlistSource<0x1700f3680> (Domain: xxx, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): Path not accessible, switching to read-only"

My programm runs on device and it also appears without being connected to Xcode.

I hope someone did solve this issue. Thank you!

Rajat
  • 10,977
  • 3
  • 38
  • 55

2 Answers2

0

Apparently, it's a bug. Rebooting the Mac solved this problem for many.

Checkout this answer on SO: Link

Community
  • 1
  • 1
Arpit Dongre
  • 1,683
  • 19
  • 30
  • But also on device? Without connection to Mac? – Julius Kaden Nov 28 '16 at 11:46
  • I always use [[NSUserDefaults standardUserDefaults] setObject:xxx forKey:@"xxx"]; There is no restrictions or maximum length for saving data there, like i read. Sometimes everything does works as intended, but then also sometimes this error occurs (loaded from Appstore). – Julius Kaden Nov 28 '16 at 12:16
0

Lots 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: Apple Developer Forums