您的位置:首页 > 移动开发

关于 Details On launch and content download, your app stores 15.83MB on the user's iCloud被拒问题

2015-12-14 12:34 639 查看
由于朋友遇到appstore上架问题2.23 Details On launch and content download, your app stores 15.83MB on the user's iCloud, which does not comply with the iOS Data Storage被拒。

2.23 Details On launch and content download, your app stores 15.83MB on the user's iCloud, which does not comply with the iOS Data Storage
这是由于把大量的数据存放在documents下的问题,appStore 的iCloud备份这里面的数据

解决方法1:就是不让iCoud备份数据,跳过ICloud的备份

Object C代码:

ios5.1 later

- (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 %@ from backup %@", [URL lastPathComponent], error);

}

return success;

}


使用方法:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:@"<myApplication>/Library/Caches"]];
}


附录:获取url的路径的方法(其实就是你文件的路径):

NSArray * arrayOfURLs = [[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask];
// make certain there's at least one file url returned by the above call
if([arrayOfURLs count] > 0)
{
// and this would just be the URL to the cache directory...
NSURL * cacheDirectoryPath = [arrayOfURLs objectAtIndex: 0];

// ... to create a file url to your actual dictionary, you'd need to add a
// filename or path component.

// Assuming you save this as a property within your object
self.cacheFileURL = [cacheDirectoryPath URLByAppendingPathComponent: @"myDatabase.db"];
}


Swift代码:

plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs){
var NSURL = plus.ios.import("NSURL");
var NSNumber = plus.ios.import("NSNumber");
var url = NSURL.fileURLWithPath(fs.root.fullPath);
var backup = NSNumber.numberWithBool(true);
url.setResourceValueforKeyerror(backup,"NSURLIsExcludedFromBackupKey", null);
plus.ios.deleteObject(url);
plus.ios.deleteObject(backup);
});


解决方法二:就是不让打的重用的数据放到Documents文件夹下

图片的缓存可以放到/tmp文件夹下会
下载可以重用的东西放/Library/Caches
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: