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


由于朋友遇到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的备份

苹果的解决办法的地址:https://developer.apple.com/library/prerelease/content/qa/qa1719/_index.html

Object C代码:

ios5.1 later

- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString
{
    NSURL* URL= [NSURL fileURLWithPath: filePathString];
    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 addSkipBackupAttributeToItemAtPath:@"<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代码:

 func addSkipBackupAttributeToItemAtURL(filePath:String) -> Bool
    {
        let URL:NSURL = NSURL.fileURLWithPath(filePath)
 
        assert(NSFileManager.defaultManager().fileExistsAtPath(filePath), "File \(filePath) does not exist")
 
        var success: Bool
        do {
            try URL.setResourceValue(true, forKey:NSURLIsExcludedFromBackupKey)
            success = true
        } catch let error as NSError {
            success = false
            print("Error excluding \(URL.lastPathComponent) from backup \(error)");
        }
 
        return success
    }

使用方法:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        
        
        addSkipBackupAttributeToItemAtURL("忽略的路径")
        
        return true
    }



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

  • 图片的缓存可以放到/tmp文件夹下会
  • 下载可以重用的东西放/Library/Caches




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WMSmile

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值