Apps must follow the iOS Data Storage Guidelines or they will be rejected

前端 未结 7 1613
栀梦
栀梦 2021-02-04 21:40

i have developed an app that can download mp3 files (nearly 6 to 8 mb of size) from online and stored in NSDocumentDirectory. my app get rejected today and says that

         


        
7条回答
  •  既然无缘
    2021-02-04 22:03

    i got my app rejected for the same reason , the solution is really simple instead of saving your downloaded files to the Documents directory you have to save them to the Cache directory which is a temp directory that don't get backed up to iCloud and can be randomly deleted by the OS on certain occasions ... this is how you save a file to the cache directory

    NSString *filePath = [[self applicationCachesDirectory] stringByAppendingPathComponent:fileName];
    
    
    BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents: receivedData attributes:nil];
    

    EDIT

    NSString *filePath = [[self applicationCachesDirectory]  stringByAppendingPathComponent:[NSString stringWithFormat:@"psalmsMusic%d.mp3",i]];
    NSLog(@"ffffdffffdd psalmsMusic%d.mp3",i);
    i++;
    BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents: receivedData attributes:nil];
    if ( flag )
      NSLog("success");
    

提交回复
热议问题