ios - Using addSkipBackupAttributeToItemAtURL to prevent backing up files -



ios - Using addSkipBackupAttributeToItemAtURL to prevent backing up files -

i can't work. app rejected allowing files backed unnecessary. stop told utilize addskipbackupattributetoitematurl mark files not backed up.

i placed next code, provided apple, in appdelegate.

- (bool)addskipbackupattributetoitematurl:(nsurl *)url { assert([[nsfilemanager defaultmanager] fileexistsatpath: [url path]]); nserror *error = nil; bool success = [url setresourcevalue: [nsnumber numberwithbool: yes] forkey: nsurlisexcludedfrombackupkey error: &error]; if(!success){ nslog(@"error excluding %@ backup %@", [url lastpathcomponent], error); } else { nslog(@"\n\nfile %@ removed backup.\n\n", url); } homecoming success; }

i add together next in didfinishlaunchingwithoptions

[self addskipbackupattributetoitematurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"blue" oftype:@"jpg"]]]; [self addskipbackupattributetoitematurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"fred" oftype:@"jpg"]]];

it works fine in simulator. on actual phone though, does't work , gives me think resolves permissions error.

error excluding blue.jpg backup error domain=nscocoaerrordomain code=513 "the operation couldn’t completed. (cocoa error 513.)" userinfo=0x1740741c0 {nsurl=file:///private/var/mobile/containers/bundle/application/c8559aba-181e-4686-a5ed-2adca283d2e4/petjournal.app/blue.jpg, nsfilepath=/private/var/mobile/containers/bundle/application/c8559aba-181e-4686-a5ed-2adca283d2e4/petjournal.app/blue.jpg, nsunderlyingerror=0x174058e10 "the operation couldn’t completed. operation not permitted"}

can help guide me through this.

ios objective-c xcode icloud

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -