Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSUbiquitousKeyValueStore not working... at all

I'm having what seems to be a unique issue. My NSUbiquitousKeyValueStore is simply not working between launches in the simulator. That is, I'm not even talking about iCloud sync or anything like that, I can't get it to pass the simple test below!

var kvs = NSUbiquitousKeyValueStore.defaultStore()
if kvs.synchronize() == true {
  println("kvs synchronised")
}
println(kvs.stringForKey("test"))
println(kvs.setString("WORKED", forKey:"test"))
println(kvs.stringForKey("test"))

Everytime I run my iOS 8 app in the simulator, this prints out the same message.

kvs synchronised
nil

WORKED

Yes, iCloud is configured and enabled in the Entitlements. Yes, even "Key Value Store" is checked. Yes, the Simulator account is setup for iCloud syncing.

It seems that even the local backing SQLite DB is getting clobbered between every run? I'm at a loss.

like image 280
hcatlin Avatar asked Nov 11 '22 06:11

hcatlin


1 Answers

I've read that iCloud does not work at the simulator but it's not official. Nothing is written about it at Apple's documentation.

I'm working at an application where I use simple key/value storage implementation and, for my surprise, it worked once or twice in thousands of tests. It's definitely not reliable.

like image 173
Luiz Felipe Avatar answered Jan 04 '23 02:01

Luiz Felipe