Apple Rejected my Ap so I need some help here.

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Apple Rejected my Ap so I need some help here.

Post by FireWorx » Fri Feb 17, 2012 6:04 pm

Hi,
Need some help here.
My iPad application stores and uses PDF maps contained in 5 folders (for organization purposes) although I could condense them all into 1 large folder. (about 200 PDF's total) and I had them stored in the IOS /documents folder. I DO WANT TO BE ABLE TO UPDATE THESE MAPS VIA ITUNES. Apple design review wants me to store these PDF's in the IOS /Library/Private Documents folder. They also want me to set the "Do Not Backup Extended Attribute " of this folder to prevent iTunes or iCloud from backing up the data.

Here is the link they provided. https://developer.apple.com/library/ios ... index.html

They have given me directions to do this but it is in a programing language I don't understand. Here it is.

"You can use the following method to set the "do not back up" extended attribute. Whenever you create a file or folder that should not be backed up, write the data to the file and then call this method, passing in a URL to the file."


Listing 1 Setting the Extended Attribute
#include <sys/xattr.h>
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];

const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;

int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}

Can anyone help me figure out a way to accomplish this with live code?
Thanks,
Dave

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: Apple Rejected my Ap so I need some help here.

Post by CALL-151 » Fri Feb 17, 2012 10:50 pm

You've run up against the new iCloud data storage guidelines. The issue is summarized at http://www.chrisboyd.net/2011/11/icloud ... uidelines/

I fear that this will be an issue for many LC developers. As far as I know, there's no way to set the necessary file/folder attribute within LC. Hopefully this will be included in the upcoming LC5.5 release. If not, perhaps someone can throw together a quick and dirty external that will allow us to toggle the "do not backup" attribute.

In the meantime, the only option I can think of is for you to put your PDFs in the Caches folder, which means they will not be accessible via iTunes.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Apple Rejected my Ap so I need some help here.

Post by Dixie » Fri Feb 17, 2012 11:30 pm

Hi...

Unless I'm missing something... I think this is covered in page 22 of the iOS release notes... under the heading 'file and folder handling.'

be well

Dixie

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: Apple Rejected my Ap so I need some help here.

Post by CALL-151 » Sat Feb 18, 2012 12:04 am

A way to set the Do Not Backup Extended Attribute? Not in my version of the release notes (Rev 69).

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Apple Rejected my Ap so I need some help here.

Post by FireWorx » Sat Feb 18, 2012 4:35 am

Moving the PDF folders over to the other directory and re coding the links is easy but setting the "do not back up attribute" to meet the iCloud requirement is the problem.

Listing 1 Setting the Extended Attribute
#include <sys/xattr.h>
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];

const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;

int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}

Can anyone help me figure out a way to accomplish this with live code?
Thanks,
Dave

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Apple Rejected my Ap so I need some help here.

Post by gpb01 » Sat Feb 18, 2012 9:50 am

FireWorx wrote:Moving the PDF folders over to the other directory and re coding the links is easy but setting the "do not back up attribute" to meet the iCloud requirement is the problem.
....
Can anyone help me figure out a way to accomplish this with live code?
Thanks,
Dave
Simpy, at moment, you can't without writing in XCode an External (http://www.runrev.com/developers/docume ... rnals-sdk/) ...
... in a future release, probably, RunRev will include some new flags in the standalone builder (... or in the 'specific for iOS' language extensions).

Guglielmo

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: Apple Rejected my Ap so I need some help here.

Post by CALL-151 » Sat Feb 18, 2012 1:24 pm

Fireworx,

My interpretation of the new rules its that you don't need to set the attribute for files in the /Library/Caches folder, because it's not backed up to iCloud. If you move your PDFs there, you should be OK. The only problem is that your users won't be able to see/update the PDFs via iTunes, and if a user runs low on space, iOS may purge the contents of Caches folders. Unless someone throws together a quick external, this is the only way I can think of to get your app approved. Once there's a better solution in LC, you can then update your app.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Apple Rejected my Ap so I need some help here.

Post by gpb01 » Sat Feb 18, 2012 1:39 pm

Call-151,
he said very clearly "I DO WANT TO BE ABLE TO UPDATE THESE MAPS VIA ITUNES" so ... he can't use the Cache folder ... ;)

Guglielmo

CALL-151
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 206
Joined: Wed Oct 20, 2010 11:00 am

Re: Apple Rejected my Ap so I need some help here.

Post by CALL-151 » Sat Feb 18, 2012 5:37 pm

gpb01 wrote:Call-151,
he said very clearly "I DO WANT TO BE ABLE TO UPDATE THESE MAPS VIA ITUNES" so ... he can't use the Cache folder ... ;)

Guglielmo
Understood. I'm just suggesting a compromise that will at least get his app in the store. He seems to have the impression that even with the Caches folder he'd also need to set the do not backup attribute. That's not how I read the guidelines.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Apple Rejected my Ap so I need some help here.

Post by monte » Sun Feb 19, 2012 5:30 am

Hi

I just uploaded a new external to http://mergext.com to do this. I've called it a beta but I can't imagine there being any issues with it.

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Apple Rejected my Ap so I need some help here.

Post by FireWorx » Sun Feb 19, 2012 7:45 am

Thanks Monte,
I will check it out.
Dave

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Apple Rejected my Ap so I need some help here.

Post by gpb01 » Sun Feb 19, 2012 9:15 am

monte wrote:Hi
I just uploaded a new external to http://mergext.com to do this. I've called it a beta but I can't imagine there being any issues with it.
Cheers
Monte
Good job Monte, ...
... maybe can you complete the external by adding the possibility to set also the NSFileProtectionKey (using SetAttributes:ofItemAtPath to set NSFileProtectionComplete or NSFileProtectionNone) ;)

It would be very useful ... :)

Guglielmo

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Apple Rejected my Ap so I need some help here.

Post by monte » Sun Feb 19, 2012 9:18 am

Sure, I'll take a look.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Apple Rejected my Ap so I need some help here.

Post by gpb01 » Sun Feb 19, 2012 10:01 am

monte wrote:Sure, I'll take a look.
Thanks a lot Monte ...
... if you login on the Apple developer area, you can read this : http://adcdownload.apple.com//wwdc_2011 ... ations.pdf ... starting from page 31.

Also the video is very clear ;)

Guglielmo

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Apple Rejected my Ap so I need some help here.

Post by monte » Sun Feb 19, 2012 11:08 am

Done, you can set the file protection key to any of the four available options. Also added a function to check if protected data is available. It is also possible to send callbacks if protected data becomes available or unavailable but unless someone needs that I won't bother.

Don't forget to vote for what you want next on mergExt!!!

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply