Search code examples
iosiphoneicloud

disable iCloud?


I don't want to use iCloud and my last release was flagged by Apple as using it, even thought I never setup anything. All of my provisioning has the check box off for iCloud. I didn't add any entitlements.

#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;
}

SO now I am trying the above code sample.

I am calling it like this:

[self addSkipBackupAttributeToItemAtURL:"/var/apps/xxxxx/myapp/library/mydatabase.db"]

I don't get an error but the darn iCloud still thinks its going to back it up.

Did I need to modify the procedure above? I am sending a static string, should that be different? I have a NSString with the fall path but the procedure wants a URL? Not sure how to do that or it it makes a difference


Solution

  • Set your file path in filePath String.

    NSURL *filePathURL = [[NSURL alloc]  initFileURLWithPath:filePath];
    [self addSkipBackupAttributeToItemAtURL:filePathURL];