简体   繁体   中英

Plist works in simulator but not on device

Is there any reason that data pulled in from a plist will show in the simulator but not on my test device? Worked all day on making it work and was thrilled until I tested it on the actual device. Strange.

Thanks.

I dont know if this answer is going to help. If the plist is stored in the Resources, the simulator will work properly. On the device, the plist file will be given only a read permission and data cannot be modified in this file. A work around will be to save the plist file upon installation into the Application documents folder where the file will be given read and write permissions. Test case: I had a usersettings plist file to change the view of a user from a table view to scroll view. The setting needed be done in the application. This was working fine on simulator but on device, it was not working because the default value was not able to be modified. So i copied the plist file to documents and was able to do it successfully. code for copying file will be the same as you see in sqlite example.

Know you have this fixed, but wanted to follow up as this thread is the top Google hit if you are searching on this problem.

Check the name of the plist file. Seems the simulator is not case sensitive, but the iPhone is. For example if you have a file named "Foo.plist" but reference it as "foo.plist" in your code, it will work fine in the simulator but fail to load on the device.

Seems recreating the plist fixed my issue. Works in simulator and device now.

Not much info to go on here... plists typically work well. Have you done a Build->Clean?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM