Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

iCloud for Unity3d

Discussion in 'Assets and Asset Store' started by jemast, Dec 20, 2011.

  1. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello,

    We are jemast software, a small indie software development studio. We have released an iCloud plugin for Unity to the Asset Store. More than 300 million iOS users have registered iCloud accounts that are ready to use in your games with just a few lines of code.



    iCloud for Unity

    Bullet Points:
    → Share documents and data across iOS and Mac OS devices with ease using Apple's iCloud.
    → Manipulate files and directories with just a few lines of code.
    → Save player preferences in a breeze with familiar methods.
    Conflict resolution for both files and player preferences.
    Falls back nicely to local storage when iCloud is not supported.
    → You get access to full Xcode library commented source code (Full Edition only).
    Easy to integrate in your projects as it mirrors well-known APIs.

    Requirements:
    - Requires Unity iOS (Standard/Free or Pro) for iOS or Unity Pro for OS X.
    - Requires registration to Apple's iOS Developer Program to use iCloud for development and release purposes on iOS.
    - Requires registration to Apple's Mac Developer Program to use iCloud for development and release purposes on OS X.



    Feel free to give us feedback on this!


    Thanks,

    jemast software
     
    Last edited: Jul 22, 2014
  2. Yusuf-AKDAG

    Yusuf-AKDAG

    Joined:
    May 13, 2009
    Posts:
    280
    -ignore previous comment,I obviously misunderstood-
     
    Last edited: Dec 20, 2011
  3. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Well, I'm not under the impression we're trying to profit from Apple's trademark but I may be wrong.

    This plugin allows you to use Apple's iCloud in your projects, we're not providing a separate cloud service.

    The logo is just a mix of Apple's iCloud logo shape and Unity's logo color pattern. We view this logo as enhancing the message that this allows you to use iCloud in your Unity projects and in no way we intended to make you think that this was anything separate.

    Again, it's just a plugin bridging to Apple's iCloud features and if we're misusing their branding with our logo we'll happily change it. No offense or greedy scheme intended. :)

    Edit: I will clarify in opening post that this does use Apple's iCloud :)
     
    Last edited: Dec 20, 2011
  4. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    Forgive me but why would you create such thing? iCloud was meant to be used as backup service to save all your documents between platforms; and with the limited space that you have there (and the performances issues since that platform was not meant to be used to save game assets), I am not sure how could a user take advantage of this interface that you made for iCloud, other than maybe save preferences, settings and such.

    Don't want to bring down your idea, is not my intention, but I would just like to know what is exactly the reason that pushed you to create such plugin; maybe I am just blind and cannot see very obvious uses.

    iCloud is free btw, but unless you have an iPhone or iPad you cannot use it to the full extent (is not like Amazon cloud service, to be clear), just in case that someone does not have clear what is iCloud :)
     
  5. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Maybe I should put up a link to iCloud for people who might not be familiar with it.

    To be clear about what iCloud can do for your apps, it allows you to store files or directories as well as key-value preferences (in a very similar way to PlayerPrefs) in iCloud storage. This is not the backup part of the service, it's the sharing part (similar to sharing calendars or contacts across your devices). For example, Apple uses it to share your iWork documents across your devices.

    So usage case is anything you can think of you want to be shared between devices that may have iCloud enabled. Could be save games, screenshots, settings, unlocks, ... you can use it in a similar way to Steam Cloud for example.

    While iCloud is not ubiquitous in terms of platforms (only works on iOS 5.0+ devices and Mac OS 10.7.2+ devices), my feeling is this will have a more widespread use than other cloud services and all this plugin does is allow you to use it. We're not trying to provide a cloud service, we're enabling you to use Apple's one. If your user has registered his device for iCloud and enabled data sharing, he will automatically benefit from it and won't need to register or login to a separate service which he might never do.

    By the way, iCloud is also for Mac devices (Mac OS Lion 10.7.2+) and you can share between iOS and Mac devices as well.


    Edit: About iCloud's widespread use part, I'm only talking Apple's platforms if this was not obvious.

    Edit2: About @darshie76 on iCloud not fit for save games or things larger than small preferences, actually it is. First, you get 5GB which is plenty big considering the things that doesn't count to the storage (Photo Stream, Music, ...). Then, the way iCloud works makes it just as fast as local storage. When you write a file to iCloud, in fact all your application does is writing it locally to a special hidden folder. It's all local so it's very fast, and the only slowdown you could notice is that it uses a complex technique called "file coordination" to make sure that you are not writing on your file while the iCloud process is doing the same (in practice, that means you could get a 1 or 2 seconds slowdown). You can then quit your app and leave your device and this is where Apple's iCloud process will kick in action and move the file to the cloud without you noticing anything. So to be clear, you don't have to wait for the file to be in the cloud, it's all instant and happens in the background even when not in the app anymore.
     
    Last edited: Dec 21, 2011
  6. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
  7. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
  8. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Yes it does for some parts of their services (contacts, calendars and other stuff as well) but not for the "documents data" part for third party applications that allow your app to share files preferences across devices.

    Edit: Though if these API become available for Windows or other platforms, we'll make them available in our plugin. But I have no information on whether they intend or not to do this.
     
    Last edited: Dec 28, 2011
  9. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    I can definitely see the benefit of using iCloud to store save games (though perhaps not other things, such as screenshots). Being able to share save games between different devices (iPhone and iPad) can be a fantastic selling point, especially for universal apps. This plugin seems to include all the functionality to achieve this, right out of the box. When I get round to getting my iOS game to the polishing stage, this will definitely be a purchase consideration!
     
  10. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello,

    Just a quick update to notify that version 1.1 has been submitted to the Asset Store. It contains the following enhancements:

    - Callbacks for JCloudData and JCloudDictionary notifying updates from iCloud.
    - Methods for getting modification date of JCloudDocument files and directories.
    - Under-the-hood enhancements paving the way for asynchronous API.

    As mentioned in the last point, the next release should implement those asynchronous methods. You can already use C# threading to use the plugin asynchronously (we have an example for this on our website) but those methods will provide a new way to this process by using callbacks.
     
  11. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    698
    Hey, I'm start starting to integrate your plugin into an iOS app and I have few question:

    1) I'm trying to get a list of files from my base directory on iCloud. How do I access it? Will this work: JCloudDocumentAsyncOperation jcop = JCloudDocumentAsync.DirectoryGetFiles(""); ?

    Edit: Yes, "" should work for the base directory!

    2) I can get notified when values change in the key-value store, but how do I get notified when a file changes too? JCloudManager seems to have some functionality for that, but how do I use it properly? JCloudData has such handy Register/Unregister functions...

    3) Is there a way to append to a file instead of always overwriting the whole file? I've never really worked much with files before, so I'm a bit lost here. What I'm doing locally is to append new events to a binary file like this: (see below) Is something like this possible?

    Code (csharp):
    1.         using (FileStream stream = new FileStream(filePath, FileMode.Append)) {
    2.             using (BinaryWriter writer = new BinaryWriter(stream)) {
    3.                 writer.Write(t.time.Year); //year
    4.                 writer.Write (t.time.Month); //month
    5.                 writer.Write (t.time.Day); //day
    6.                 writer.Write (t.time.Hour); //hour
    7.                 writer.Write (t.time.Minute); //min
    8.                 writer.Write(t.category); //category
    9.                 writer.Write(t.amount); //amount
    10.  
    11.                 writer.Close();
    12.             }
    13.         }
     
    Last edited: Jun 7, 2012
  12. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    698
    I've run into an issue... JCloudData.PollCloudDataAvailability() returns true and I can store and retrieve values, but JCloudDocumentAsync.PollCloudDocumentAvailability() returns false and any attempt of storing or loading a file fails. Why is that? Is there any way to half-break the system?

    Also: Is it okay that Libraries/libjCloudPlugin_iOS.a shows up red in the Linked Frameworksand Libraries section in XCode?
     
    Last edited: Jun 7, 2012
  13. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    698
    I overlooked that I had to enable Entitlements in XCode!
    PollCloudDocumentAvailability( ) now returns true, but it still fails at writing a file! For some strange reason I can however create the testfile with your TestBed scene! :/
     
    Last edited: Jun 7, 2012
  14. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    698
    Heureka! At last I got files to write and read!

    Code (csharp):
    1.     IEnumerator Start() { //TEMP TEST
    2.         yield return StartCoroutine(TestFileWriteRead()); //DOES NOT WORK
    3.         yield return StartCoroutine(JCloudRoutine.Run(TestFileWriteRead())); //WORKS
    4.     }
    5.     public IEnumerator TestFileWriteRead() {
    6.         System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
    7.         JCloudDocumentAsyncOperation asyncOperation = JCloudDocumentAsync.FileWriteAllBytes("abc.txt", encoder.GetBytes("2012-5-7-16-46-6-32"));
    8.         yield return asyncOperation;
    9.         Debug.Log ("cloud document did write bytes with : " + (asyncOperation.boolResult ? "success" : "failure"));
    10.  
    11.         asyncOperation = JCloudDocumentAsync.FileReadAllBytes("abc.txt");
    12.         yield return asyncOperation;
    13.         encoder = new System.Text.UTF8Encoding();
    14.         Debug.Log ("cloud document did read bytes ; read this : " + ((asyncOperation.bytesResult == null) ? "(null)" : encoder.GetString(asyncOperation.bytesResult)));    
    15.     }
    I thought this JCloudRoutine.Run thing was just your weird way of doing coroutines, but turns out it makes a pretty big difference. So for the sake of anyone else, please mention the importance of this little fact far more explicitly on the documentation page...

    And while you're at it... ;) The text on your Documentation page (especially the Detailed Instructions section) could do with some formatting. It's quite hard to follow a bunch of steps when they're all mangled into one long paragraph without any kind of highlighting or line-breaks...
     
  15. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello,

    Sorry for the late reply, seems like I haven't set up notifications properly on this thread.

    About getting notifications when file changes, this is not implemented yet but you can use the modification date as a starting point. I'll look into it (not easy to implement properley).

    About appending this is not implemented as well, but definitely something I can look into (relatively easy to implement).

    About the library showing up red in Xcode, it does the same to me since Unity 3.5 and it doesn't seem to be an issue (it's still linked).

    About JCloudCoroutine.Run, sorry there was no way around it as Unity doesn't allow subclassing YieldInstruction.

    About the documentation being heavy, yes I know, I just need to find some time to clear it up but I'd rather spend some time to implement new features (though I'll get around working on those docs).

    You can reach me via e-mail: contact [at] jemast [dot] com and I'll help you out with any issue you may get!

    Again, sorry for the late reply, I had set up a poor notification timing.
     
  16. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    698
    Sure, no problem! Thanks for your reply!

    File appending would be great to have!

    I found a pretty simple workaround for file change notifications - I just put a timestamp in JCloudData for each file, so I get notified when it gets updated from another device.

    My little test-app is done and waiting for approval - now I'm back at my main project and trying to make the iOS and Mac versions of NEW ORBIT stay in sync via iCloud...
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,555
    Hi, I may be needing an iCloud plugin. I am wondering, is the iCloud information app-specific? Or can I share iCloud information between two different games I made?
     
  18. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    You can share data between applications. All you have to do is specify the same identifiers for iCloud containers in both apps.

    If I'm not mistaken, the only limitation is that you have to put iCloud identifiers that match a valid bundle ID when you submit to iTunes Connect. So you should first submit one app with valid iCloud IDs and then you can submit the other app with iCloud IDs matching the first one (you don't have to wait for anything to get approved, it just has to be added to iTunes Connect).

    Of course all of this only works if you submit from the same team account. You can't share data between 2 apps from 2 different developer accounts.
     
  19. FritzBraun

    FritzBraun

    Joined:
    Nov 23, 2012
    Posts:
    2
    Hi,

    I've bought and implemented your plugin and it's been nice and painless so far, I've just replaced PlayerPrefs with JCloudData, but I'm wondering how the system deals with conflicts.

    So, in the case that the user has been playing on two devices, and one wasn't on iCloud and then suddenly it is then we're going to have conflicts, and I'd like to be able to just say "give the user whichever value is better".

    As far as I can see, we can get notifications of changes due to iCloud, but not anyway of resolving conflicts. Could the notifications be extended so they not only say what keys have been changed but also what the old value was and what the new value is so that we can decide how to resolve any conflicts?

    cheers,

    Iain
     
  20. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    @FritzBraun

    At the moment, conflicts are automatically resolved using the most recent version.

    I'll edit the notification behavior so you can get the old value and set your custom logic to retain any value (rewriting it and saving over the new value).

    I'll get this done before the end of the week. Please send me an e-mail at jeremie.diprizio [at] jemast.com so I can keep you updated and send you the new version as soon as it's done so you don't have to wait for Asset Store validation.

    Thanks !
     
  21. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Hi,

    I've bought the plugin today and there is one thing thats not very clear to me. Assume I save only simple key-value data with JCloudData, like an int for some highscore.

    What I don't quite understand is: when iCloud data is synced? Is it done automaticly by the plugin at startup?
    Or do I have to use RegisterCloudDataExternalChanges(Component componentOrGameObject); every startup to update my JCloudData or is it only for gettings updates during a gameplay sessions?

    Thanks!
     
  22. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello Lukas,

    By design, iOS has a background app running that syncs iCloud documents data whenever it wants (surely it does this in a clever manner). Which means that it can be done when your app is not running though I'm not a 100% sure on that since the plugin still asks for synchronization. The plugin will ask for synchronization on the first call you make to JCloudData (the plugin starts lazily so it does not start with your app).

    I encourage you use the changes monitoring API as it will help resolving conflicts. I have an update coming out real soon which fixes an issue with file reading and iOS 6 (due to a breaking change I did not notice) but it also implement conflict resolution for JCloudData (giving you the old value and the new value so you can pick which one you want to retain). I'm also working on conflict resolution for files and I'm also trying to tackle local backups (it's not that easy to do as there are tricky situations where the plugin cannot determine what to do).

    Send me an email at jeremie.diprizio [at] jemast [dot] com and I'll send you the update so you don't have to wait for Asset Store approval (it'll be done tomorrow).
     
  23. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Thanks for the info!
    Apple isn't very clear explaining at what point the iCloud is being synced and it appears to be a bit of a mystery to you too :) I'll just implement the sync update listener then. I've send you a mail to get the new version with conflict resolution, which sounds nice.
     
  24. FritzBraun

    FritzBraun

    Joined:
    Nov 23, 2012
    Posts:
    2
    Hi Jeremie,

    I was wondering if there was any way the user can delete data added through jclouddata? I assumed it would show up in the settings->iCloud menu on their iPad, but it doesn't. Would I have to switch to jclouddocument to allow user management of the data?

    cheers,

    Iain
     
  25. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello Iain,

    I'm not 100% sure but it does not seem there is a way to delete key-value store data from iOS directly (not in iCloud settings anyway).

    If that solution is fit, you can add an option in your game to delete all key-values (call the JCloudData.DeleteAll(); method to wipe all).

    You can also modify your app so it has it's own panel in the iOS settings menu with a "Reset iCloud data" toggle button but I'm quite sure your app still has to run once so you can apply this setting and actually do the deletion (that should be doable by adding/modifying some stuff in the generated Xcode project though I'm not entirely familiar with the whole process).

    Let me know if you were looking for something more specific? I'm not sure what your scenario is but the way I would handle it is adding this as an option in an in-game settings menu.


    By the way, for all our users, we've got some cool updates in the pipeline. We've recently added conflict resolution for key-value storage and we'll be adding conflict resolution for file storage as well "real soon" (Unity's official timing, though it's already 90% done). We're also adding better error handling that will allow to clean up some code. For later releases, we'll have global file/directory changes monitoring and we're looking into handling local backup (to avoid loosing data when disabling iCloud).

    Finally, right after the next update for file conflict resolution, we'll be working on documentation, specifically adding more examples of real-life scenarios with best practices, a FAQ for giving a better understanding of how iCloud works (what happens when user enables/disables for example) and a detailed roadmap.
     
  26. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi jemast,

    Still enjoying your plugin but have a question for you. I have exported my game to android and also leave your icloud plugin intact. Is this a good way to do or is it recommended to use the playerprefs. Because this plugin falls back to playerprefs if icloud is not found. This will save me some time changing code in android.

    Cheers, Roy
     
  27. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello Roy,

    If you don't intend to use any other mechanism (Google Cloud services or others), then you have virtually nothing to do and the plugin will use PlayerPrefs with almost no overhead. Even if you're using conflict resolution your code can stay as is (with the obvious fact that it won't do anything at all).

    Let me know if there are new things you'd like to be included in the plugin (we certainly have more features in the pipeline for file management).


    Regards,

    Jérémie.
     
  28. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi Jérémie, Awesome!

    Maybe make this plugin also compatible with android :) without modify the users code :)?

    /Roy
     
  29. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    @Tapgames: Cross-platform cloud services is indeed something we're considering but in all honesty, while for the player preferences (key-value) part it should be doable without much hassle, the files directories part would require much more abstraction than we currently offer in the plugin (it's not as simple as we would like it to be but we're learning a lot with this plugin and hope to get better and better with time).

    I think we still have some enhancements to do on the file part and probably an API cleanup (without breaking things) but as we're working on a new game project right now, this is something we'll consider at some point (implementing others' platforms cloud services). We're also closely monitoring iOS 7 so we'll be ready once it's released if there are any required changes.


    On an unrelated note, to celebrate Unity 4.2 and the new free iOS deployment, we're introducing 2 new editions of iCloud for Unity with a lower price point: iOS Edition and OS X Edition. We're not trying to beat Microsoft at product segmentation (we'd love to do an Ultimate edition :)), but offer a more affordable price point to the free users so they can implement iCloud in their iOS games, release them on the App Store and later if they want to release an OS X version of their game (hopefully because their iOS version has been successful) get the OS X edition and have the plugin work with no change.
     
  30. echoic

    echoic

    Joined:
    Apr 29, 2011
    Posts:
    89
    Hi jemast,

    I'm interested in buying the plugin, but am still trying to figure out how it works. My application uses a LOT of PlayerPrefs saves. Instead of changing all of them to JCloudData, can I just use JCloudData.Save() to save all PP to iCloud whenever the application is disabled?

    Thanks!
     
  31. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    It's a bit more complicated than that actually. You'll have to switch all your calls to PlayerPrefs.Set/Get* to JCloudData.Set/Get* including PlayerPrefs.Save(). When you do that, JCloudData methods will try to figure if iCloud is available.

    If it is, it will store data in iCloud. iOS 5.1+ systems won't let you know if iCloud is disabled or enabled (for key-value storage) and will store data in the iCloud key-value store regardless (with no syncing if disabled ; autosync when it is later enabled). For users on iOS 5 with iCloud disabled, the plugin will fall back to NSUserDefaults and auto-move data to iCloud when later enabled. For users on iOS 4 or any other platform (Android, ...), JCloudData methods will call PlayerPrefs.

    Though before swapping methods, you should be aware that if your game is already live and using PlayerPrefs, you are responsible for transferring existing data to the cloud. At the moment, it is not possible to get a list of key-values in PlayerPrefs so only you can transfer those keys. To do this, simply check for JCloudData.PollCloudDataAvailability and if it's available try to transfer to iCloud (get key-values in PlayerPrefs and compare them to JCloudData key-values).

    Let me know if you need more details or code examples!
     
  32. echoic

    echoic

    Joined:
    Apr 29, 2011
    Posts:
    89
    So JCloudData.Save wouldn't simply save all PlayerPrefs associated with the app to iCloud (if available, but fall back on PP)? My app is iOS +6.0 and saving all PlayerPrefs associated with the app is all I'm looking to do, no need for choosing individual PP. Just making sure I don't over complicate things like I normally do.
     
  33. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    No, we cannot do that because there is no way to retrieve what you stored in PlayerPrefs (no API to retrieve a list of keys ; you could do it by finding/parsing the file Unity generates but that's not something we wanted to do as we wouldn't consider this reliable). Therefore you have to swap all your PlayerPrefs calls with JCloudData. As an example, if you were doing this:

    Code (csharp):
    1. PlayerPrefs.SetInt("Score", newScore);
    2. PlayerPrefs.Save()
    You'll now have to do:

    Code (csharp):
    1. JCloudData.SetInt("Score", newScore);
    2. JCloudData.Save();
    Same thing for GetInt, GetFloat, SetFloat... Swap everything.

    The catch being, if your app was already live on the App Store and using PlayerPrefs, you'll have to make sure that PlayerPrefs are moved to JCloudData. You could do that at app start:

    Code (csharp):
    1. void Start() {
    2.   if (JCloudData.PollCloudDataAvailability()) { // iCloud may be available, we have to transfer
    3.     int localScore = PlayerPrefs.GetInt("Score");
    4.     int cloudScore = JCloudData.GetInt("Score");
    5.  
    6.     // Pick best score
    7.     JCloudData.SetInt("Score", Math.Max(localScore, cloudScore));
    8.     JCloudData.Save();
    9.  
    10.     // Cleanup PlayerPrefs
    11.     PlayerPrefs.DeleteAll();
    12.     PlayerPrefs.Save();
    13.   }
    14. }
    That'll add a little overhead to your app start but nothing you should worry about (you could always add some check to see if data was already ported).

    Let me know if you need additional details.

    EDIT: By the way, since you're on iOS 6+, JCloudData.PollCloudDataAvailability() will always return true due to the way the system handles iCloud key-value store (it says it's always enabled even if the user has disabled iCloud; the system handles transferring to iCloud when the user enables it). Though you should keep it, if you intend to port your game to Android or any other platform, JCloudData.PollCloudDataAvailability() will obviously return false and then all calls to JCloudData will be equivalent to calling PlayerPrefs (it will store data in PlayerPrefs).
     
    Last edited: Aug 13, 2013
  34. echoic

    echoic

    Joined:
    Apr 29, 2011
    Posts:
    89
    Awesome, thanks jemast!
     
  35. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    935
    Hi,

    I'm trying to use your plugin but for some reason it's not working properly. i.e. it seems to work per device since once I delete the app and install it again, the file is still there. But it doesn't work across devices... It seems that each device has it's own file and they don't sync.

    This happens in my code and your TestBed scene. Any idea what might be going on?
     
  36. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Hello,

    First off sorry you're getting troubles. When using the test bed scene, does hitting the "Poll Cloud Document Availability" button return "cloud document available".

    If no, let me know if you're on OSX or iOS but the reason is iCloud entitlements are not configured properly. I'll guide you through it.

    If yes (it says iCloud is there) and you're on iOS, then I'll have to ask if you have migrated the iCloud account used on your device to iCloud Drive (iOS 8 beta). Even if you're using a non-iOS 8 device, iCloud Drive will turn off sync globally on your account for legacy Documents & Data if you did migrate to iCloud Drive (check out iOS 8 release notes).
     
  37. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    935
    Hi jemast,

    You are right, I inadvertently "upgraded" my iCloud account when I tested OSX Yosemite.

    Everything is working fine with another account. Thanks! ;)
     
  38. AtomicChimp

    AtomicChimp

    Joined:
    Aug 9, 2011
    Posts:
    47
    Is your iOS iCloud plugin still working with iOS8? I have been using the Prime31 iCloud plugin and having tons of problems with it of late, especially since iOS8 was released. With no solution in sight from P31 (they cop out with blaming Apple for it not functioning properly and telling me to go to Apple to plead for a solution), I need another iCloud plugin that actually works.
     
    Last edited: Sep 19, 2014
  39. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    Sorry for the reply delay.

    Testing during beta and GM phase did not indicate any issue. I'm still conducting testing with all the production released features but it seems all good. I should point out that we don't support the new CloudKit features and that's not on our roadmap at the moment. Though preferences and iCloud Drive (as well as legacy Documents & Data) is fully supported.

    Are you sure the issues you're running into are not tied to iCloud Drive migrations? When migrating your iCloud account to iCloud Drive, both Preferences (key-value store) and Files (Documents) will stop syncing on pre-iOS 8 and pre-Yosemite devices (the fact that they did this without shipping an update to Mavericks to support iCloud Drive is just insane...).

    Anyway, if you want to give it a try send me an e-mail at jeremie [dot] diprizio [at] jemast [dot] com and I'll send you the full version to try out and see if it does the job for you.
     
  40. AtomicChimp

    AtomicChimp

    Joined:
    Aug 9, 2011
    Posts:
    47
    Hi @jemast,
    Thank you for your reply. Last night, I decided to give your plugin a try and purchased it on the Asset Store. I tried it out first with your demo scenes in a test project and all worked well. So, I added it to my game today and it is working like a charm.

    I have not implemented iCloud Drive and made no changes to my previous plugin, other than upgrading the plugin software since there was an update. Bad decision there. P31 blamed Apple for the iCloud not working but I implemented your plugin in exactly the same way as I have been with the other plugin (both within my Unity code and in Xcode settings) and your iCloud plugin is working great. The problem with the other plugin is not Apple and not how I implemented it. The problem was the update and poor support.

    Thank you SOOO much for offering this plugin. The integration was seamless. You have a new happy customer. :)

    Now, if you had a social networking plugin...
     
  41. smoakes86

    smoakes86

    Joined:
    Jan 15, 2014
    Posts:
    5
    Hi @jemast

    It looks as though everything works in iOS 8 iCloud Drive, as long as the user has it turned on for the game. However, if they disable it, the game will no longer save at all. It looks like with iCloud Drive Apple are doing something similar to iOS 5.0 and below. Is there any chance you'd be able to update the plugin to reflect this?

    As a reminder:

    "Will the user retain its key-value data if he disables iCloud?
    ... If he’s using iOS 5-, disabling iCloud will make the plugin fallback to NSUserDefaults as iCloud key-value storage cannot be queried anymore."
     
  42. smoakes86

    smoakes86

    Joined:
    Jan 15, 2014
    Posts:
    5
    @jemast

    In fact, you don't even have to upgrade to iCloud Drive. On iOS 8, just disable iCloud (whether drive or not) and data won't save.
     
  43. smoakes86

    smoakes86

    Joined:
    Jan 15, 2014
    Posts:
    5
    Just ran a test with a cloud document instead of data, that seems to work fine. The problem only seems to be happening with cloud data.
     
  44. aikitect

    aikitect

    Joined:
    Dec 28, 2012
    Posts:
    28
    Hello Jemast, I just downloaded this plugin for iOS and had a question. If I use CopyCloudToLocal("textfile.txt"), what is the complete path of the "textfile.txt"? That is, does it use Application.persistentDataPath on iOS? Or is it some other directory? Thanks!
     
  45. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    @aikitect If you did get in touch in mail with me a few hours ago, then I replied to you. If you're not the one who contacted us by email about a similar issue, then do get in touch with me by e-mail: jeremie [dot] diprizio [at] jemast [dot] com

    Sorry about those APIs, they're undocumented as they were added to tackle a particular issue and we're looking into wrapping them around a better set of local/cloud synchronization API.
     
  46. aikitect

    aikitect

    Joined:
    Dec 28, 2012
    Posts:
    28
    Yes that was me! Just to recap what was I wrote as a review on the Asset Store...

    "This is hands down one of the best Unity plugin purchases that I have made, and I have bought over 20 different plugins over the last year:

    - The API is much more powerful than Prime31. I was able to easily backup a proprietary database to iCloud, and do synchronization between multiple devices without a hitch.
    - The documentation is great. It was super easy to set up jCloud, and the website provided all the examples that you would need to get started.

    - MOST IMPORTANT: The support from Jemast and Jeremie is top-notch. They provided me with very thorough answers to the questions I had (I wanted to do some pretty advanced stuff). I had a minor bug that I reported on a Friday, and Jeremie worked with me through the entire weekend to identify and fix the bug. He sent me a revised version on Monday, and it works perfectly. The turnaround time for responses was also really quick.

    IN CONCLUSION: If you're looking for a Unity iCloud solution, BUY THIS PLUGIN!"

    Thanks again for all your help!
     
  47. airwick

    airwick

    Joined:
    Jul 15, 2013
    Posts:
    8
    I'm having the same issue reported by smoakes86.

    Is there a way to avoid this?
     
  48. jemast

    jemast

    Joined:
    Dec 7, 2011
    Posts:
    141
    @airwick We're talking about JCloudData/iCloud key-value store? Will definitely look into this, though give me 24h to 48h max leeway as I'm quite booked right now. If you haven't done so, be sure to shoot me an e-mail (jeremie.diprizio@jemast.com) and I'll keep you updated on my progress.
     
  49. airwick

    airwick

    Joined:
    Jul 15, 2013
    Posts:
    8
    Yes, the JCloudData/iCloud key-value store.
     
  50. ThiagoDeserto

    ThiagoDeserto

    Joined:
    Dec 13, 2012
    Posts:
    6
    I'm having an issue with Conflict Files for more than 1 week and I tried contact the support, but still have no answer.

    The problem is simple, when I have a conflict in a file I try to loop the list of the conflict versions, but I got the InvalidVersionIdentifier Error in the first version.

    The weird part is that is the same code found in the website as code example.

    I'm currently using:
    Unity: 4.6.4p3
    iCloud Plugin: 2.6.7
    xCode: 6.3.1
    iOS: 8.1.3

    Code (CSharp):
    1. JCloudDocumentOperation operation = JCloudDocument.FileHasConflictVersions(profile + kExtension);
    2.  
    3.         while (operation.finished == false)
    4.         {
    5.             yield return null; // Wait for 1 frame
    6.         }
    7.      
    8.         // Look for error -- if any, handle & stop coroutine here -- ignore cloud unvailable as it simply means conflicts are not handled
    9.         if (operation.error.HasValue && operation.error.Value != JCloudDocumentError.CloudUnavailable)
    10.         {
    11.             HandleDocumentError(operation.error.Value,profile);
    12.             yield break;
    13.         }
    14.      
    15.        // Did looking for conflict trigger a result?
    16.         if (((bool?)operation.result).HasValue && (bool)operation.result == true)
    17.         {
    18.             // We have conflicts -- sort them out
    19.             operation = JCloudDocument.FileFetchAllVersions(profile + kExtension);
    20.             while (operation.finished == false)
    21.             {
    22.                 yield return null;
    23.             }
    24.          
    25.             // Look for error -- if any, handle & stop coroutine here
    26.             if (operation.error.HasValue)
    27.             {
    28.                 HandleDocumentError(operation.error.Value,profile);
    29.                 yield break;
    30.             }
    31.          
    32.             // Get conflict versions
    33.             JCloudDocumentVersions versions = (JCloudDocumentVersions)operation.result;
    34.  
    35.  
    36.             foreach (JCloudDocumentVersionMetadata metadata in versions.versionsMetadata)
    37.             {
    38.                 // Read version bytes
    39.                 operation = JCloudDocument.FileReadVersionBytes(profile + kExtension, metadata.uniqueIdentifier);
    40.                 while (operation.finished == false)
    41.                     yield return null;
    42.  
    43.                 // Look for error -- if any, handle & stop coroutine here
    44.                 if (operation.error.HasValue)
    45.                 {
    46.                     // Here I always get an error of Invalid Version Identifier.
    47.                     HandleDocumentError(operation.error.Value, profile);
    48.                     yield break;
    49.                 }
    50.