iOS : I can't write my file

后端 未结 2 1454
天涯浪人
天涯浪人 2021-01-28 12:57

I want to write a file on my iPhone app. My file is in my project\'s folder, but when I try to reach it :

NSString *myFile = [[NSBundle mainBundle] pathForResour         


        
2条回答
  •  深忆病人
    2021-01-28 13:50

    As already said you can't write to the main bundle on an actual device.

    To your other question:

    When you run your app in the simulator xcode will copy your project to a folder in your library directory .. in your case to:

    /Users/Damian/Library/Application Support/iPhone Simulator/5.1/Applications/

    Every app you run in your simulator has a folder there. Apps are not run in the folders where you actually edit your code.

提交回复
热议问题