Page 1 of 2

Apple Rejected my Ap so I need some help here.

Posted: Fri Feb 17, 2012 6:04 pm
by FireWorx
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

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

Posted: Fri Feb 17, 2012 10:50 pm
by CALL-151
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.

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

Posted: Fri Feb 17, 2012 11:30 pm
by Dixie
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

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

Posted: Sat Feb 18, 2012 12:04 am
by CALL-151
A way to set the Do Not Backup Extended Attribute? Not in my version of the release notes (Rev 69).

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

Posted: Sat Feb 18, 2012 4:35 am
by FireWorx
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

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

Posted: Sat Feb 18, 2012 9:50 am
by gpb01
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

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

Posted: Sat Feb 18, 2012 1:24 pm
by CALL-151
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.

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

Posted: Sat Feb 18, 2012 1:39 pm
by gpb01
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

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

Posted: Sat Feb 18, 2012 5:37 pm
by CALL-151
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.

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

Posted: Sun Feb 19, 2012 5:30 am
by monte
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

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

Posted: Sun Feb 19, 2012 7:45 am
by FireWorx
Thanks Monte,
I will check it out.
Dave

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

Posted: Sun Feb 19, 2012 9:15 am
by gpb01
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

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

Posted: Sun Feb 19, 2012 9:18 am
by monte
Sure, I'll take a look.

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

Posted: Sun Feb 19, 2012 10:01 am
by gpb01
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

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

Posted: Sun Feb 19, 2012 11:08 am
by monte
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