First at all here is how you can enable iCloud support:
Howover I did got wawe of Entitlements issues, but finally I got fixed that too. Here is the final Entitlements content I used, putted in maually in noteblok:
const char* iCloudURL()
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *bundleID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
NSLog(@"bundleID is: %@", bundleID);
NSString *appID = [NSString stringWithFormat:@"N3L62N3PZ4.%@", bundleID];
NSLog(@"appID is: %@", appID);
NSURL *testCloudURL = [fileManager URLForUbiquityContainerIdentifier:appID];
NSString *myURL = [testCloudURL absoluteString];
NSLog(@"testCloudURL is: %@", myURL);
strcpy(iString, [myURL UTF8String]);
This will either return null or a url. The url is actuelly just a folder pointer , so there require no networking uploading and such. iOS doing that its self in a thread.
in GlBasic, you can check iCloud test doing something like this:
IMPORT "C" const char* iCloudURL()
iCloud$=REPLACE$(iCloud$, "file://localhost/private", "")
Howover remember you can NOT access files directly from the iClould folder. If you doing that, then GlBasic will crash out by a GLB Error 3. But you can do a COPYFILE from AppData file to your iCloud folder before use, something like this for saving:
FUNCTION LoadCloudStr: File$
LOCAL SaveFile2$=REPLACE$(SaveFile$, "save.ini", "save2.ini")
LOCAL SaveFile2$=REPLACE$(SaveFile$, "Save.ini", "Save2.ini")
COPYFILE File$, SaveFile2$
LoadStr(SaveFile2$, "all", 1)
A Example for iCloud use:
I use iCloud for sync the game by the scoring and stars progress between devices. Its checking if the scoring and stars got is higher on the cloud file and then eventuelly update it. Also I read the cloud file when exiting a level, before sync back again to avoid eventeully confict.
Another example could been updating savegame from a light to paid version of the game. YES, using iCloud will been possible to share data between app if user have enabled iCloud.
This is extractly why I looked Dropbox, but I still do that in later day. Howover I did got iCloud working first.
PS. TEAMID and APPID is NOT the same. Remember to replace those with your own of course.
Accessing the apple icloud is always a bonus.
Seems very powerful, though i can not test this atm.
Note 'Codesnippets' may not be the final destination for this thread.
Perhaps it might belong in networking, inlines, or somewhere else.
Fell free to move to inline/third party forum and sticky there.
I just want to see dropbox and/or iCloud support for more games to sync progress. It's very nice to see game play on my iPhone and later countinue on iPad without required to start over again.
Very nice indeed! :good:
Small repeated line typo I the last listing BTW.
today (yes long time ago im posted in thist thread), im fixed red warnings, which might happens in a newer xcode (missing IMPORT commands). So im hope this iCoud still works and hope people use this to save thier game.
This sticky thread is old and is no longer work due file permission bugs in ios7. So I'm dedicated this to been out and hence the thread can been unsticky.
Instead I'm later create a new thread when I'm looking how the key value database work, which seen more easier.
this thread can now been locked. That due im will soon later this week give source code how to get iCloud to work again.
Its is no longer possible to use files, but im found a way to get and put strings to iCloud instead. Its only contains 4 functions and is straight away. So im will create a new thread about that and how to get that to work. Its also pretty more simple when code signing first works.
So im wont support iCloud Files anymore.
I don't like locking threads but I changed the name. You can also edit your first post and write that this no longer works/isn't supported.
im got the new iCloud system working using Get() and Put() Strings. So im will just create a new thread later this or next week. That why.
Actuelly its is much easier supporting iCloud this way, even there impose some limits (number of keys and size of them). Its should not been a issue with games like those we create.
The hard part is get the code signing to work. When that is working, rest is straight away.
Now im want this thread safe to been lock now, because im wont want users to wrote in this thread at all with old code. The reason is this one works much better and easier by using keystore instead of files: