问题
So I have a simple goal, just to get this working. So theoretically if you ruined this.
- Triggered save players
- waited a bit
- Deleted the app
- Rebuilt (downloaded)
- Triggered restore then the word "MEDO" would print to the console
But instead it is null, making me pretty sure that it is not saving to iC cloud some reason. I followed this tutorial. Perhaps it is too outdated to work?
func c_restoreCharecters()
{
let icloud = NSUbiquitousKeyValueStore.defaultStore()
println(icloud.objectForKey("username"))
}
func c_savePlayers()
{
let icloud = NSUbiquitousKeyValueStore.defaultStore()
icloud.setObject("MEDO", forKey: "username")
println(icloud.synchronize())
}
Obviously I am going to use this concept for something completely different in the future, but I have to get the basics down first!
Some other stuff: iCloud set up in my settings: My Entitlements file:
来源:https://stackoverflow.com/questions/33590375/key-data-not-storing-to-icloud-with-nsubiquitouskeyvaluestore-defaultstore