您的位置:首页 > 移动开发

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

2012-10-16 11:45 357 查看
苹果审核折腾人啊,这次是数据存储的事

2.23AppsmustfollowtheiOSDataStorageGuidelinesortheywillberejected

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

WefoundthatyourappdoesnotfollowtheiOSDataStorageGuidelines,whichisrequiredpertheAppStoreReviewGuidelines.

我们发现你的应用程序没有遵循iOS数据存储的指导方针,这是每个应用程序商店要求审查指南。

Inparticular,wefoundthatonlaunchand/orcontentdownload,yourappstores7.38MB.Tocheckhowmuchdatayourappisstoring:

特别是,我们发现在启动或内容下载,你的应用程序商店7.38mb。检查你的程序是多少数据存储:

-Installandlaunchyourapp

-GotoSettings>iCloud>Storage&Backup>ManageStorage

-Ifnecessary,tap"Showallapps"

-Checkyourapp'sstorage

——你的应用程序安装和启动

——去设置>>>存储和备份iCloud管理存储

——如果有必要的话,点击“显示所有应用程序”

你的应用程序的存储——检查

TheiOSDataStorageGuidelinesindicatethatonlycontentthattheusercreatesusingyourapp,e.g.,documents,newfiles,edits,etc.,shouldbebackedupbyiCloud.

iOS数据存储指南表明,只有内容,使用你的应用程序的用户创建,例如文档、新文件,编辑等,应由iCloud备份。

Temporaryfilesusedbyyourappshouldonlybestoredinthe/tmpdirectory;pleaseremembertodeletethefilesstoredinthislocationwhentheuserexitstheapp.

临时文件所使用的应用程序应该只被存储在/tmp目录;请记住删除在这个位置的文件存储,当用户退出应用程序时。

Datathatcanberecreatedbutmustpersistforproperfunctioningofyourapp-orbecausecustomersexpectittobeavailableforofflineuse-shouldbemarkedwiththe"donotbackup"attribute.ForNSURLobjects,addtheNSURLIsExcludedFromBackupKeyattributetopreventthecorrespondingfilefrombeingbackedup.ForCFURLRefobjects,usethecorrespondingkCFURLIsExcludedFromBackupKeyattribute.

数据,可以重新创建但是必须持续正常运行你的应用程序——或因为客户期望它能离线使用,应该被标上“不支持”属性。对于NSURL对象,添加NSURLIsExcludedFromBackupKey属性来防止相应的文件从备份。为CFURLRef对象,使用相应的kCFURLIsExcludedFromBackupKey属性。

Formoreinformation,pleaseseeTechnicalQ&A1719:HowdoIpreventfilesfrombeingbackeduptoiCloudandiTunes?.

有关更多信息,请见技术问答1719:我如何防止文件备份到iCloud和iTunes?。

ItisnecessarytoreviseyourapptomeettherequirementsoftheiOSDataStorageGuidelines.

Fordiscretecode-levelquestions,youmaywishtoconsultwithAppleDeveloperTechnicalSupport.Pleasebesureto:

-includethecompletedetailsofyourrejectionissues

-prepareanysymbolicatedcrashlogs,screenshots,andstepstoreproducetheissuesforwhentheDTSengineerfollowsup.

有必要修改您的应用程序以满足需求的iOS数据存储指南。

对离散代码级问题,你可能会希望咨询苹果开发者技术支持。请务必:

——包括完整的细节,你的排斥问题

——准备任何symbolicated崩溃记录,截屏和步骤来再现问题当DTS工程师跟踪。

Forinformationonhowtosymbolicateandreadacrashlog,pleaseseeTechNoteTN2151UnderstandingandAnalyzingiPhoneOSApplicationCrashReports.

Ifyouhavedifficultyreproducingthisissue,pleasetrytestingtheworkflowasdescribedin<https://developer.apple.com/library/ios/qa/qa1764/>TestingWorkflowwithXcode'sArchivefeature".

关于如何symbolicate和读一个崩溃的日志,请见技术注意TN2151理解和分析iPhoneOS应用程序崩溃报告。

如果你很难繁殖这个问题,请尝试测试工作流中描述的

<https://developer.apple.com/library/ios/qa/qa1764/>测试工作流与Xcode的存档特性”。

TechnicalQ&A1719:HowdoIpreventfilesfrombeingbackeduptoiCloudandiTunes?.

https://developer.apple.com/library/ios/#qa/qa1719/_index.html

TechnicalQ&AQA1764:TestingWorkflowwithXcode'sArchivefeature

http://developer.apple.com/library/ios/#qa/qa1764/_index.html

https://developer.apple.com/library/ios/#technotes/tn2008/tn2151.html

TechnicalQ&AQA1719

HowdoIpreventfilesfrombeingbackeduptoiCloudandiTunes?

Q:Myapphasanumberoffilesthatneedtobestoredonthedevicepermanentlyformyapptofunctionproperlyoffline.However,thosefilesdonotcontainuserdataanddon'tneedtobebackedup.HowcanIpreventthemfrombeingbackedup?

我的应用程序有很多文件,需要存储在设备上为我的应用程序功能永久妥善离线。然而,这些文件不包含用户数据和不需要备份。我怎样才能防止他们被备份?

A:OniOS,appsareresponsibleforensuringthatonlyuserdataandnotapplicationdataisbackeduptoiCloudandiTunes.TheexactstepsnecessaryvarybetweeniOSversion,sothisQAwilldescribetheprocessforeachversionofiOS.Formoreinformationonexactlywhatdatashouldorshouldnotbebackedup,seetheAppBackupBestPracticessectionoftheiOSAppProgrammingGuide.

答:关于iOS,应用程序负责确保只有用户数据,而不是应用程序数据备份到iCloud和iTunes。确切的必要步骤不同iOS版本,所以这QA将描述这个过程对于每个版本的iOS。更多信息正是数据应该或不应该备份,请参阅应用程序备份的最佳实践部分的iOS应用程序编程指南<http://developer.apple.com/library/ios/>。

Important:Appsshouldavoidminglingappdataanduserdatainthesamefile.DoingsowillunnecessarilyincreasebackupsizesandcanbeconsideredaviolationoftheiOSDataStorageGuidelines.

重要:应用程序应该避免混合应用程序数据和用户数据在同一个文件中。这样做将增加不必要的备份大小,可以被看作是违反了iOS数据存储指南。

iOS5.1andlater

StartinginiOS5.1,appscanuseeitherNSURLIsExcludedFromBackupKeyorkCFURLIsExcludedFromBackupKeyfilepropertiestoexcludefilesfrombackups.EitheroftheseAPIsispreferredovertheolder,deprecatedapproachofdirectlysettinganextendedattribute.AllappsrunningoniOS5.1shouldusetheseAPIstoexcludefilesfrombackups.

在iOS5.1开始,应用程序可以使用<http://developer.apple.com/library/ios/>NSURLIsExcludedFromBackupKey或kCFURLIsExcludedFromBackupKey文件属性来排除文件从备份。这两种api是优先于年长的,过时的方法直接设置一个扩展属性。所有的应用程序运行在iOS5.1应该使用这些api来排除文件从备份。

Listing1ExcludingaFilefromBackupsoniOS5.1

排除一个文件备份

-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL*)URL
{
assert([[NSFileManagerdefaultManager]fileExistsAtPath:[URLpath]]);
NSError*error=nil;
BOOLsuccess=[URLsetResourceValue:[NSNumbernumberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKeyerror:&error];
if(!success){
NSLog(@"Errorexcluding%@frombackup%@",[URLlastPathComponent],error);
}
returnsuccess;
}
BacktoTop

iOS5.0.1

IfyourappmustsupportiOS5.0.1,youcanusethefollowingmethodtosetthe"donotbackup"extendedattribute.Wheneveryoucreateafileorfolderthatshouldnotbebackedup,writethedatatothefileandthencallthismethod,passinginaURLtothefile.

如果你的应用程序必须支持iOS5.0.1,您可以使用以下方法来设置“不支持“扩展属性。当你创建一个文件或文件夹,不应该备份,将数据写入文件,然后调用这个方法,传入一个URL到文件。

Warning:ThecodethatfollowshasbeendeprecatedandshouldonlybeusedoniOS5.0.1orearlier.WhenrunninginiOS5.1,appsshouldusetheNSURLandCFURLkeysdescribedabove.

Listing2SettingtheExtendedAttributeoniOS5.0.1

警告:后面的代码已经被弃用,只应该用于iOS5.0.1或更早。在iOS5.1运行时,应用程序应该使用上面描述CFURLNSURL和钥匙。

清单2设置扩展属性在iOS5.0.1

#import<sys/xattr.h>

-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL*)URL

{

assert([[NSFileManagerdefaultManager]fileExistsAtPath:[URLpath]]);

constchar*filePath=[[URLpath]fileSystemRepresentation];

constchar*attrName="com.apple.MobileBackup";

u_int8_tattrValue=1;

intresult=setxattr(filePath,attrName,&attrValue,sizeof(attrValue),0,0);

returnresult==0;

}

BacktoTop

iOS5.0

ItisnotpossibletoexcludedatafrombackupsoniOS5.0.IfyourappmustsupportiOS5.0,thenyouwillneedtostoreyourappdatain
Caches
toavoidthatdatabeingbackedup.iOSwilldeleteyourfilesfromthe
Caches
directorywhennecessary,soyourappwillneedtodegradegracefullyifit'sdatafilesaredeleted.

BacktoTop

它不可能排除在iOS5.0的数据备份。如果你的应用程序必须支持iOS5.0,那么您将需要存储应用程序数据缓存来避免数据备份。iOS将会删除你的文件从缓存目录在必要的时候,所以你的应用程序将需要完全降低如果它的数据文件被删除。

DocumentRevisionHistory

Date

Notes

2012-04-23

UpdatedforiOS5.1

2011-11-10

-Fixedcriticalbugincodesnippet.

NewdocumentthatdescribeshowanappcanpreventfilesfrombeingbackeduptoiCloudandiTunes.

解决办法:

程序数据和图片、sqlite数据库---不需要云备份,(离线看需要本地数据)

用户数据(用户浏览的食谱图片、胎教音乐)---需要云备份

有临时文件就设置在/tmp---缓存等临时文件,退出需要删除

我也遇到过,之前把所有数据都存在Documents下了,改了目录就通过了

数据的问题:1-1,只有用户产生的数据应该放到/Documents里,你app产生的不要放1-2,下载可以重用的东西放/Library/Caches1-3,临时的放/tmp,不用的时候记得删掉1-4,用"donotbackup"标记需要留在设备上的数据,那些没联网也可以保证使app运行的数据(别因为连不上网拿不到数据app运行不了)他的意思,你把这个iOSDataStorageGuidelines看一遍再。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐