开发者

quick question about plist

开发者 https://www.devze.com 2023-03-05 11:46 出处:网络
Can my application download a .plist from a URL and replace the one that I built i开发者_运维知识库n xcode and shipped with the application?

Can my application download a .plist from a URL and replace the one that I built i开发者_运维知识库n xcode and shipped with the application?

Thanks Leo


No, you can't change anything in your application bundle. You must download you plist file to some folder in application sandbox (documents or caches) and read it from there.

Your possible workflow for reading that plist can be:

  1. Check if plist file is present at download location. If yes - read it from there
  2. If it is not present - read plist shipped with your bundle (or copy plist file from bundle to download location and go to step 1 - this way workflow may be a bit more consistent)


You can use an NSURLRequest to download the .plist file, and then save it the Documents directory in your app's sandbox. Use the NSSearchPathsForDocumentsInDomain() function (see the Foundation Functions reference for more info) to get the file system path to the Documents directory.

Read for More

0

精彩评论

暂无评论...
验证码 换一张
取 消