2016-05-12 11 views
2

iOSデータ保存ガイドラインに準拠する必要があるため、アプリが拒否されました。私はすでにstackoverflowでいくつかの答えを読んで、私はすでにいくつかのブログを読んで...私は私の問題を知っている最初のアプリケーションの起動時に私はサーバーからzipファイルを解凍し、 。データ保存のためにアプリが拒否されました

次のコードも使用しています。

+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { 
    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; 
    } 

ここで、このメソッドを呼び出す: -

+ (void) createEditableCopyOfDatabaseIfNeeded 
    {  
NSLog(@"Creating editable copy of database"); 
    BOOL success; 
    NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error;  
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
    NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:ddb]; 
    [self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:writableDBPath]]; 

    success = [fileManager fileExistsAtPath:writableDBPath]; 
    if (success)  
{ 
    NSLog(@"ALready exists");  return; 
    } 
    NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:ddb];  
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error]; 
    [self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:defaultDBPath]]; 
    if (!success) 
{  
NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]); 
    } 
    NSURL * fileURL; 
    fileURL = [ NSURL fileURLWithPath: ddb ]; 

    [ fileURL setResourceValue: [ NSNumber numberWithBool: YES ] forKey: NSURLIsExcludedFromBackupKey error: nil ]; 
} 

それでも私のアプリケーションだったrejected.Pleaseヘルプ。

私はリンゴからこの反応を得ました。

May 12, 2016 at 1:59 AM 
From Apple 
2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected 
Thank you for your resubmission. During our continued review, we found the following issue unresolved: 

2.23 Details 

On launch and content download, your app still stores 78.84 MB on the user's iCloud, which does not comply with the iOS Data Storage Guidelines. 

Next Steps 

Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed. 

Data that can be recreated but must persist for proper functioning of your app - or because users expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCRUFLIsExcludedFromBackupKey attribute. 

Resources 

To check how much data your app is storing: 

    - Install and launch your app 
    - Go to Settings > iCloud > Storage > Manage Storage 
    - Select your device 
    - If necessary, tap "Show all apps" 
    - Check your app's storage 

For additional information on preventing files from being backed up to iCloud and iTunes, see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes. 

If you have difficulty reproducing a reported issue, please try testing the workflow described in Technical Q&A QA1764: How to reproduce bugs reported against App Store submissions. 

If you have code-level questions after utilizing the above resources, you may wish to consult with Apple Developer Technical Support. When the DTS engineer follows up with you, please be ready to provide: 
- complete details of your rejection issue(s) 
- screenshots 
- steps to reproduce the issue(s) 
- symbolicated crash logs - if your issue results in a crash log 
+0

ダウンロードして圧縮するdbのサイズはどれくらいですか? –

+0

あなたはappleから受け取ったメッセージを共有できますか? – Hemang

+0

@KevinMac my unzip 30mbと82.6 MB – sambit

答えて

0
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:ddb]; 

これはちょっとDDBを指摘するには、いくつかのランダムな文字列です。

NSURL * fileURL; 
    fileURL = [ NSURL fileURLWithPath: ddb ]; 
    [fileURL setResourceValue: [ NSNumber numberWithBool: YES ] forKey: NSURLIsExcludedFromBackupKey error: nil ]; 

here you are not getting the path of where you copied the db, instead just opening url with string value which is why i think it is failing. To fix this call the method after this line

success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error]; 
[self addSkipBackupAttributeToItemAtURL:[NSURL URLWithString:writableDBPath]]; 
0

(1)あなたの大きなファイルがライブラリフォルダに格納されていることを確認します。 (2)AppDelegate.mのNSURLIsExcludedFromBackupKeyオプションまたはaddSkipBackupAttributeToItemAtPathを使用します。

@implementation AppDelegate 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    /* create a file outside of the Document folder like filePath1 */ 

    /* preven os from copying data file for iCloud */ 
    [self addSkipBackupAttributeToItemAtPath:[self filePathA]]; 

    return YES; 
} 

- (NSString *)filePathA { 
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES); 
    return [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Data"]; 
} 

- (NSString *)filePath1 { 
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES); 
    return [[[paths objectAtIndex:0] stringByAppendingPathComponent:@"Data"] stringByAppendingPathComponent:@"Data1.data"]; 
} 

- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *)path { 
    NSURL *url = [NSURL fileURLWithPath: path]; 
    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; 
} 
関連する問題