应用必须遵循iOS数据存储指南,否则将被拒绝 [英] Apps must follow the iOS Data Storage Guidelines or they will be rejected

查看:123
本文介绍了应用必须遵循iOS数据存储指南,否则将被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个应用程序,可以从网上下载mp3文件(大约6到8 MB的大小)并存储在NSDocumentDirectory中。我的应用程序今天被拒绝并且说

 应用程序必须遵循iOS数据存储指南,否则将被拒绝


我们发现您的应用不遵循iOS数据存储指南,即每个App Store审核指南要求的
。 iOS数据存储指南
表示只有用户使用您的应用创建的内容,例如文档,
新文件,编辑等,可以存储在/ Documents目录中 - 并备份
by iCloud。

应用程序使用的临时文件只应存储在/ tmp目录中;
请记得在用户退出应用程序
时删除存储在此位置的文件。

我曾经将音乐文件存储在NSDocumentDirectory中。
所以,这是第一次我正在做这个,我无法弄清楚实际的问题。我应该怎么做才能重新提交我的应用程序进行接受。



这里是我的代码



'pre> 的NSArray *路径= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);



的NSString * documentsDirectoryPath = [[路径objectAtIndex:0] stringByAppendingPathComponent:[的NSString stringWithFormat:@ psalmsMusic%d.mp3,I]];
的NSLog(@ DDDDDDD psalmsMusic%d.mp3,i)的;
I ++ ;


NSLog(@path%@,documentsDirectoryPath);
[receivedData writeToFile:documentsDirectoryPath atomically:YES];

真的需要一些帮助。

解决方案

我得到了我的应用程序因同样的原因而被拒绝,解决方案非常简单,而不是将下载的文件保存到您可以访问的Documents目录中我们将它们保存到Cache目录,这是一个临时目录,不会备份到iCloud,并且可以在某些情况下被操作系统随机删除...这就是将文件保存到缓存目录的方法

  NSString * filePath = [[self applicationCachesDirectory] ​​stringByAppendingPathComponent:fileName]; 


BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents:receivedData attributes:nil];

编辑

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


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

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


 We found that your app does not follow the iOS Data Storage Guidelines, which is
 required per the App Store Review Guidelines. The iOS Data Storage Guidelines 
 indicate that only content that the user creates using your app, e.g., documents,
 new files, edits, etc., may be stored in the /Documents directory - and backed up
 by iCloud. 

 Temporary files used by your app should only be stored in the /tmp directory; 
 please remember to delete the files stored in this location when the user exits 
 the app. "

i used to store the music files in NSDocumentDirectory . so, this is the first time am doing this, i cant figure out the actual problem. what should i do to resubmit my app for acception.

here is my code

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);



 NSString *documentsDirectoryPath = [[paths objectAtIndex:0]stringByAppendingPathComponent:[NSString stringWithFormat:@"psalmsMusic%d.mp3",i]];
NSLog(@"ddddddd psalmsMusic%d.mp3",i);
i++;


 NSLog(@"path %@",documentsDirectoryPath);
 [receivedData writeToFile:documentsDirectoryPath atomically:YES];

really need some help.

解决方案

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(@"ddddddd psalmsMusic%d.mp3",i);
i++;
BOOL flag = [[NSFileManager defaultManager] createFileAtPath:filePath contents: receivedData attributes:nil];
if ( flag )
  NSLog("success");

这篇关于应用必须遵循iOS数据存储指南,否则将被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆