iCloud ANE

Adobe Air Native Extensions


$19.99 $25.00



iCloud Storage enables iPhone and iPad apps to store documents and settings across iOS.

This implementation of the iCloud ANE supports Key-Value Stores. Key-Value Data Storage is best for storage and sharing small amounts of data. The values are strings but using JSON we can store AS3 primitives and objects in the iCloud. The typical use case is to store save data and purchase information. In our applications, we use iCloud to store and restore save data across multiple user devices. So, if the user purchases a new iPad, their in-app consumables and save states will automatically transfer over from their old device. This is actually one of the conditions for approval in the AppStore if using consumables. Since Apple does not keep track of consumables, the developer must; the quickest way is to provide a restore button that reads purchased consumable data from iCloud tied to the user's account and not the device.

Usage

Create a Unique Provision Profile

  1. Go to the iOS Provisioning Portal
  2. Create a new app id for your application, note the Bundle Identifier, we will need it later
  3. Check "Enable for iCloud"
  4. Create a new Development profile for the App ID you just created. Do the same for the Distribution profile.
  5. Download the profiles. You will be using this new development profile to sign your application.

Add Entitlements to app.xml

Open-app.xml. Replace [[TEAMID]] and [[BUNDLEID]] with your team ID:

Use For Development:

 

For Distribution, be sure to change the signing profile to use distribution. Then change the entitlements key "get-tasks-allow" to false.

		get-task-allow
		

Using the Native Extension

var iCloud:iCloudANE = new iCloudANE();

// storing data
// so.data is some shared object data. but it can just be a generic string
iCloud.store("save", JSON.stringify(so.data));	

// retrieving data
var iCloudSave:String = iCloud.getStringForKey("save"); 

// restoring the data as an as3 object
so.data = JSON.parse(iCloudSave);