@Rob Miracle
When do you think there will be a solution for saving local files?
Does the user have to be using iCloud for the iCloud plugin to work?
I would imagine so. It stores the data to that specific users “cloud”.
Then I am sure this makes sense as a solution for storing game data (like high score, etc).
The problem is your app also needs to work while the device is offline.
You can’t force a user to use iCloud. But you can encourage them and not being able to save things is encouragement.
We are looking at adding support for user preference style KVS that’s local. It’s even more restricted on the amount of data you can save with it. I need to get back with Engineering after the holidays are over. Many people are still returning from their vacations and such.
Rob
You of course could also use the Parse plugin. Still requires internet access, but it doesn’t require iCloud. This would pass Apple’s rules.
Rob
If you were to submit your app and tell the user they must turn on iCloud, I suspect Apple would reject your app for forcing the users to use it.
Rob
I voted for the NSUserDefaults, however I was using ice.lua that sits on top of sqlite3. A working sqlite3 would be more valuable than NSUserDefaults I think.
Yes, this is my number one concern. All our apps are well under the 200MB limit but we need a solution for local storage for saving preferences. If there’s no solution for this, we won’t have the option to use IAPs.
I got a first version of “Freeze! 2 - Brothers” working on the Apple TV, but I have the same problems saving my settings and values.
Xcode gives me this error:
Nov 13 21:15:30 Apple-TV kernel[0] <Notice>: Sandbox: Freeze 2-ZIP tvO(178) deny(1) file-write-create /private/var/mobile/Containers/Data/Application/13B65E7C-4BC7-4513-8D84-3C8D55DBC506/Documents/settings.json
I simply need this to store the progress of the user, that e.g. he is in World 03 in Level 17 and I need to store all the level times.
So I don’t even need 500KB, 5KB would be enough.
But without the chance to save stats no games are possible.
Maybe that’s the reason why the cool Coronalabs team started work on iCloud saves today. :-)
But if we can get 500KB with NSUserDefaults like thassman wrote it would be perfect, too, and maybe faster to implement.
Thanks & best
Andreas
I’m going to throw out an option here. Regardless of what ever we do with iCloud, your Apple TV pretty much has to be network connected. Parse.com or setting up your own Coronium.io server and store whatever you want. NSUserDefaults should not be hard to implement in Enterprise.
NSUserDefaults will have a 0.5mb limit
CloudKit’s Key-Value pairs will have a 1mb limit
Finally, while there seems to be no local data store, Apple does talk about the caches directory. Have you tried to open/close files in system.CachesDirectory?
Rob
I do have a backend where i can store the games state.
But how do i get a unique id for the device, it has to be something that is returned by the OS, cause i cannot create it myself and save it locally as i normally would do.
Cheers,
Tommy
There is the OpenUDID plugin (iOS only) that will work. system.getInfo() has a “deviceID” option which should return an allowed unique ID that can be used. Of how about a novel idea, don’t tie it to the device at all, but to a user ID. That way people on Android devices that support multiple users won’t interfere with other user’s saved data. If someone gets a new device, since it’s tied to the user, not the device, they can pick up where they left off.
Rob
Hi,
thanks for implementing iCloud-Key-Value-Storage, this really is great, I now will use this for “Freeze!” and “Freeze! 2 - Brothers” so the game progress is synced across all devices, even between the phone/tablet and upcoming tvOS versions.
But we still need access to NSUserDefaults:
This is important according to Apple if the Apple TV is offline - the game still needs to know about the selected language, the current level of the game etc.
So the correct way to set this up is:
1.) save all the info (level progress etc.) you need for the player to continue his game locally using NSUserDefaults
2.) additionally save all this stuff using iCloud KVS to sync with the same game on phone/tablet
If Apple tv is online use the iCloud KVS values, if offline use the local backup from NSUserDefaults.
To set this up should be much less effort than implementing iCloud KVS - and again, thanks for that, will start to work with this now.
Best
Andreas
We have a feature request for this at: http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/10744452-ability-to-read-nsuserdefaults-on-ios
But it doesn’t have a lot of votes. Engineering said this should be easy to implement, but we just have to get it in the work queue.
Rob
Hi Rob,
thanks for the tip, I just voted.
I guess when more dev will target tvOS this will get more important.
Best
Andreas
I just voted as well. This really is something that should be standard. Other items, IMHO, like Game Center should require popular vote…
[quote name=“JonPM” post=“314687” timestamp=“1450662835”]I just voted as well. This really is something that should be standard. Other items, IMHO, like Game Center should require popular vote…[/quote] Hi Jon, thanks for upvoting NSUserDefaults! But on Game Cente support I strongly disagree, every game that needs to be taken seriously has to have at least Leaderboards and Achievements. It’s not so much about the players (don’t get me wrong, many love & demand this), it’s more about Apple: It’s even harder to get picked by the Apple Editorial Team for a feature if you don’t support basics like Game Center. They need stories, like “Freeze! 2 now is available for iOS and tvOS, and game progress, Achievements & Leaderboards are shared across all devices!”. With stories like this they will promote their Apple TV, and if you cannot deliver this promise they just will pick another game for a promotion. I will only publish the tvOS version of the game when I can support Game Center, otherwise my chance to be featured might be gone.