2014年3月5日 星期三

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

最近公司的APP被退了,原因"Apps must follow the iOS Data Storage Guidelines or they will be rejected"

稍微查了一下,是違反了iCloud相關的使用規定
https://developer.apple.com/icloud/documentation/data-storage/

簡單的說

<Application_Home>/Documents  會自動備份
<Application_Home>/Library/Caches 會自動備份,但是空間不足是可能會被清除

<Application_Home>/tmp 不會自動備份,但是應該在程式結束時清空


 被退件的原因就是,什麼東西都放在Documents底下,然後iCloud自動備份使用的空間過大


解法其實也蠻簡單的,就是設定特定的資料夾不去備份就好了
https://developer.apple.com/library/ios/qa/qa1719/_index.html

不過這裡有個很重要的小地方,要對不同版本使用不同的方法

尤其在取得資料夾路徑的地方
[NSURL urlWithString:path] - 5.0.1
[NSURL fileURLWithPath:path] - 5.1 and higher


使用不對是不會回傳正確的東西的,切記切記