2013-12-18 19 views
1

原因申請遭拒同樣的原因之前2.23

2.23:應用程序必須遵循的iOS數據存儲的準則,否則將被拒絕 2.23

我們發現您的應用不符合iOS的數據存儲指南,這是根據App Store評論指南要求的。

特別是,我們發現在發佈和/或內容下載時,您的應用程序將存儲64 MB。要檢查您的應用程序有多少數據存儲:

  • 安裝並運行你的應用程序
  • 進入設置> iCloud中>存儲&備份>管理存儲
  • 如有必要,請點擊「顯示所有的應用程序」
  • 檢查您的應用程序的存儲

iOS的數據存儲準則表明,只有用戶創建的使用你的應用程序,例如,文檔,新文件,編輯等,應通過iClo備份內容UD。

應用程序使用的臨時文件只能存儲在/ tmp目錄中;請記得在用戶退出應用程序時刪除存儲在此位置的文件。

可以重新創建但必須堅持正常運行應用程序的數據 - 或者因爲客戶希望它可供脫機使用 - 應標記爲「不備份」屬性。對於NSURL對象,請添加NSURLIsExcludedFromBackupKey屬性以防止備份相應的文件。對於CFURLRef對象,請使用相應的kCFURLIsExcludedFromBackupKey屬性。

欲瞭解更多信息,請參閱技術Q & A 1719:如何防止文件備份到iCloud和iTunes?

需要修改您的應用以符合iOS數據存儲指南的要求。 對於離散的代碼級問題,您可能希望諮詢Apple開發者技術支持。請務必:

  • 包括您拒絕的完整細節問題
  • 準備任何symbolicated崩潰日誌,截圖,並重現步驟爲,當DTS工程師跟進的問題。

有關如何符號化和讀取崩潰日誌的信息,請參閱技術說明TN2151瞭解和分析iPhone OS應用程序崩潰報告。

如果您在重現此問題時遇到困難,請嘗試按照https://developer.apple.com/library/ios/qa/qa1764/技術問題中所述測試工作流程Q & A QA1764:如何重現只有App Review或用戶正在看到的崩潰或錯誤。 和我AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    NSString *pathCaches = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; 
    NSString *pathTmp = [NSHomeDirectory() stringByAppendingPathComponent:@"/tmp"]; 
    NSString *pathDocuments = [NSHomeDirectory() stringByAppendingPathComponent:@"/Documents"]; 

    [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathCaches]]; 
    [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathTmp]]; 
    [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathDocuments]]; 
    return YES; 
} 

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL 
{ 
    assert([[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]); 

    const char* filePath = [[URL path] fileSystemRepresentation]; 

    const char* attrName = "com.mycompany.MyApp"; 
    u_int8_t attrValue = 1; 

    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); 
    return result == 0; 
} 

設置此功能.sqlite3文件沒有下載,所以我的推杆在/文件和其他PDF文件和圖片下載 和我的應用程序具有相同的理由 被拒絕我忘記了什麼? 請幫我

謝謝

+0

什麼是他們給你具體的錯誤消息?他們是否抱怨說您在安裝時存儲的數據不是用戶生成的? – brandonscript

+0

你是不是讓@「/ Documents」來備份?在第三個addSkipBackupAttributeToItemAtURL?評論一下,然後再次提交。 –

+0

r3mus我編輯了我的問題 –

回答

2

在您要提交的iOS版本5.0.1及以上版本,可以使用下面的代碼的情況。我不認爲你需要跳過從iCloud備份緩存和tmp目錄因爲iCloud不關心這些目錄。

+(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)fileURL { 

// First ensure the file actually exists 
if (![[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) { 
    NSLog(@"File %@ doesn't exist!",[fileURL path]); 
    return NO; 
} 

// Determine the iOS version to choose correct skipBackup method 
NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; 

if ([currSysVer isEqualToString:@"5.0.1"]) { 
    const char* filePath = [[fileURL path] fileSystemRepresentation]; 
    const char* attrName = "com.apple.MobileBackup"; 
    u_int8_t attrValue = 1; 
    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); 
    NSLog(@"Excluded '%@' from backup",fileURL); 
    return result == 0; 
} 
else if (&NSURLIsExcludedFromBackupKey) { 
    NSError *error = nil; 
    BOOL result = [fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error]; 
    if (result == NO) { 
     NSLog(@"Error excluding '%@' from backup. Error: %@",fileURL, error); 
     return NO; 
    } 
    else { // Succeeded 
     NSLog(@"Excluded '%@' from backup",fileURL); 
     return YES; 
    } 
} else { 
    // iOS version is below 5.0, no need to do anything 
    return YES; 
} 
} 

如果數據可以從服務器被下載,然後代替你下載的文件保存到文檔目錄將它們保存到緩存目錄是不被備份到iCloud,可以是臨時目錄在某些場合由操作系統隨機刪除。

+0

你的意思是我替換這個函數而不是我的函數? –

+0

是的。您可以評論Cache和Tmp目錄代碼。 – Mavericks

+0

你的意思是這個 NSString * pathCaches = [NSHomeDirectory()stringByAppendingPathComponent:@「Library/Caches」]; NSString * pathTmp = [NSHomeDirectory()stringByAppendingPathComponent:@「/ tmp」]; NSString * pathDocuments = [NSHomeDirectory()stringByAppendingPathComponent:@「/ Documents」]; [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathCaches]]; [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathTmp]]; [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:pathDocuments]]; –

0

的問題是在這裏:

const char* attrName = "com.mycompany.MyApp"; 

不要改變你的包ID值,它應該永遠是:

const char* attrName = "com.apple.MobileBackup"; 
+0

還有其他嗎? –

+0

您可以使用@ user3097889解決方案,但請記住,這不能用您的捆綁ID替換。 –