Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

iCloud storage exceeded #84

Closed
10goC opened this issue Jan 12, 2016 · 11 comments
Closed

iCloud storage exceeded #84

10goC opened this issue Jan 12, 2016 · 11 comments

Comments

@10goC
Copy link

10goC commented Jan 12, 2016

Hi
My app is being rejected by apple because it stores more than 20mb on iCloud storage.
I know that this is related to this plugin, but I don't know how to prevent it.
Do you have any clue?
Thanks!

@nikDemyankov
Copy link
Member

Hi,

The problem is that iOS creates a backup of the Application Support folder by default. And this is where plugin files are stored. It need to exclude them from the backup. Will try to fix this soon.

@nikDemyankov nikDemyankov added this to the v1.2.4 milestone Jan 12, 2016
@hassellof
Copy link
Contributor

Adding the below to config.xml seems to fix the issue for me:
<platform name="ios"> <preference name="BackupWebStorage" value="local"/> </platform>

@nikDemyankov
Copy link
Member

This could do the trick, but I think I'll still have to exclude plugin folders from being backed up.

@hassellof
Copy link
Contributor

I think you are right @nikDemyankov. I'm not entirely sure of how it works in practice.

I'm guessing that it might be possible that it gets backed up to icloud twice, with both the app asset files and the webview cache of the same files being backed up to iCloud.

However, my understanding is that setting the BackupWebStorage preference to local just disables backup of the webview stuff to icloud, localstorage and cookies etc. But it is kind of weird if it actually backs up the cache as well.

Perhaps it solves my problem simply because I'm just lucky to get below the threshold when the localstorage etc. is not being copied to iCloud.

@10goC
Copy link
Author

10goC commented Jan 12, 2016

Thanks @hassellof. Apparently that didn't work though. The people from apple pointed me towards this documentation: https://developer.apple.com/library/ios/qa/qa1719/_index.html

@nikDemyankov
Copy link
Member

@10goC yes, this is what I'm planning to do. Luckily, all files are stored in one main directory, so if I understood correctly from the docs - I just need to tell iOS not to back up this particular folder, and this will be enough. Although, I can't check if this really helped, because this can be checked only by submitting new version of the app on the App Store.

@10goC
Copy link
Author

10goC commented Jan 12, 2016

@nikDemyankov If you can test on an iOS device, you can go to settings / iCloud / storage / manage storage / [Device name] and there you can see the amount of space each app stores on iCloud. I'm trying to implement this fix myself for this app. I'll tell you if I have any success. Thanks!

@nikDemyankov
Copy link
Member

Thanks for the info. If you are trying to fix this in the plugin itself, then it should be done in this method.

@10goC
Copy link
Author

10goC commented Jan 13, 2016

@nikDemyankov thanks for the tip! It worked like a charm. Here's how I put it:
HCPFilesStructure.h

/**
 * Add skip backup attribute to file to prevent automatic storage in iCloud
 *
 * @param filePathString the path to the file
 *
 * @return BOOL true on success, false on failure
 */
+ (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString;

HCPFilesStructure.m

+ (NSURL *)pluginRootFolder {
    NSURL *supportDir = [[NSFileManager defaultManager] applicationSupportDirectory];
    NSURL *pluginRootFolderUrl = [supportDir URLByAppendingPathComponent:CHCP_FOLDER isDirectory:YES];
    if([[NSFileManager defaultManager] fileExistsAtPath: pluginRootFolderUrl.path]){
        [[self class] addSkipBackupAttributeToItemAtPath:pluginRootFolderUrl.path];
    }
    return pluginRootFolderUrl;
}

And of course the code for addSkipBackupAttributeToItemAtPathcopy-pasted from apple.

@nikDemyankov
Copy link
Member

Good that it worked out for you :) Will add this in the next version.

nikDemyankov added a commit that referenced this issue Jan 17, 2016
@nikDemyankov
Copy link
Member

Released in v1.2.4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants