iphone write to file fails

匆匆过客 提交于 2019-11-29 17:24:30
taskinoor

Why are you trying to write in resource directory? Have you checked this?

This fails on the device because you cannot write to the application's bundle folder, only to the /tmp, Documents, and Cache folders. If users were able to modify the bundle, the digital signature for the app would no longer be valid and no one would be able to reliably obtain your intact app from the App Store and run it.

This works on the simulator, however, because your operating system will let you write to pretty much anywhere in your home folder, including the application bundle folder. OS X functionality is not restricted in the same way iOS's is restricted.

This is part of iOS's sandbox approach to security. The solution is to write to the /tmp, Documents or Cache folder, instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!