Plist writing to a real machine is different from a simulator.

Source: Internet
Author: User

All articles on this site are
X1135768777
Original, reprinted must be explicitly noted:
Address: http://blog.csdn.net/x1135768777/article/details/7623237

On iPhone and iPad, folder resouces is read-only and cannot be written. The document and temp folders can be read and written.

Recently I am working on a project. It is possible to write plist on the simulator, but not on the real machine. The last time we met was that the layout of the uitextview simulator was very different from that of the real machine. After all, the simulator was just a simulator!

Not much nonsense

Just change the storage path, for example, put it under the document:

Nsstring * markname = @ "Book 1, page 5th"; // Add the Book Number and page number nsarray * Doc = nssearchpathfordirectoriesindomains (nsdocumentdirectory, nsuserdomainmask, yes ); nsstring * docpath = [Doc objectatindex: 0]; nsstring * doclocation = [docpath stringbyappendingpathcomponent: @ "bookmark. plist "]; nsmutablearray * markarray = [[nsmutablearray alloc] usage: doclocation]; [markarray addobject: markname]; nslog (@" % @ ", markarray); [markarray writetofile: doclocation atomically: Yes];

I will not explain it at a glance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.