Skip to main content
Inspiring
December 3, 2011
Answered

iOS5.0.1 ‘Do Not Backup’ attribute for saved files?

  • December 3, 2011
  • 7 replies
  • 4135 views

Anyone from Adobe know if there are provisions to support the new iOS 5.0.1 way you need to save files?

Since November 2011 Apple have updated the way you need to save files on iOS 5.0.1.

I know there an ANE extension to overcome the problem, you can find it at:

http://www.jampot.ie/ane/ane-ios-data-storage-set-donotbackup-attribute-for-ios5-native-extension/

and the new Apple rules here:

https://developer.apple.com/library/ios/#qa/qa1719/_index.html

In my opinion this must be implemented directly in the AIR ecosystem, and not rely on third party solutions.

As I have made the StageWebViewBridge class and it uses extensively the filesystem, I need know which must be my next steps in the development.

Thanks

This topic has been closed for replies.
Correct answer

Hi:

This native extension can be really helpful. Developers can prcisely control what to backup on the cloud.

But,

you can also get around the new iOS data guidelines just by tweaking File APIs, Because in iOS there is default behaviour to the directories. for eg (Documents is always backed up, /Library/Caches is never backed up.) You can follow http://www.saumitrabhave.com/2011/11/air-ios-solving-apps-must-follow-ios.html

If you need precise control over the attribute, Native Extensions might be the best way.

7 replies

January 17, 2013

With AIR 3.6 latest prerelease,

A new property, preventBackup is introduced in the File API, which when set prevents a file or a folder from getting backed up on the iCloud. This property works on iOS 5.1 devices and later.

Another static property, File.cacheDirectory has been added, which points to the <APPLICATION_HOME>/Library/Caches directory on iOS devices, and files in this directory are not backed up. So, the above workaround is not required.

You can find additional details on this feature here<http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-6_flashplayer11-6_releasenotes.pdf>

Known Participant
December 9, 2011

I know that shared objects not run in iOS 5.1 rules (because it put the content in "Libray/Application Support" instead "Libray/Caches").

Saddly my app save all local preferences in shared objects. I decided it because its little info and its very easy to add data and recover it (instead multiple items with key-value pairs like ints, strings, booleans, objects, array, arraycollections).

Saumitra in your blog you comment:

"we currently have is to "Not to use LSO"...or you may want to create some class like MyLSO which provides the similar functionality using File APIs(which in turn use the following solution)"

In your example you add some string to FileStream using writeUTFBytes() 

Its possible to use an key-value pairs in this solution like in Shared Object?

Its possible to put an arraycollection like in Shared Object?

Or you would recommend me switch to SQLite database?

Thanks so much!

Known Participant
December 17, 2011

Maybe you can also serialize the objects then save them locally to text files?

Inspiring
December 8, 2011

As you comment I have find the solution 2 days ago at your blog ;-), I ha ve updated my library and it seems to be ok, I need to test the library in android ( because I have changed the way I emty the tmp folder) , an after I will update...

I will send you some test, this way you can see if sure is ok...

Thanks anyway 4 you post.

Participant
December 8, 2011

At first we also sought to find a solution without additional workarounds.

So we migrated our Flex/AIR projects away from File.applicationStorageDirectory to File.documentsDirectory.

I believe that will ok if your data is user generated & critical. This method uses the current AIR framework with no extra workarounds.

But if like us you are downloading data and need to store this without the danger of being deleted then the use of File.documentsDirectory in your App will get Rejected.

Our 'Do Not Backup' ANE should allow you to modify your existing File code slightly without a major rewrite because we have also developed a helper File storage package (ie.jampot.device.DataStorage) which uses File objects itself to do the work.

A simple way to do this is a quick find and replace for:

"File.applicationStorageDirectory(" with "DataStorage.filePrivate("

Then after a file has been saved simply apply the iOS Do Not Backup ANE to that directory.

private var iCloud : MobileBackup = new MobileBackup();

iCloud.doNotBackup( DataStorage.filePrivate.nativePath );

Yes it would be nice to have this built-in to the AIR framework, but for now the bottom line is even if you use Xcode you would still have to to rewrite parts of your code.

David

JamPot.ie

PS. Looks like a nice project you are working on, I'll have to check it out

Correct answer
December 8, 2011

Hi:

This native extension can be really helpful. Developers can prcisely control what to backup on the cloud.

But,

you can also get around the new iOS data guidelines just by tweaking File APIs, Because in iOS there is default behaviour to the directories. for eg (Documents is always backed up, /Library/Caches is never backed up.) You can follow http://www.saumitrabhave.com/2011/11/air-ios-solving-apps-must-follow-ios.html

If you need precise control over the attribute, Native Extensions might be the best way.