Xcode not copying latest resource file to iPhone

前端 未结 11 1115
我寻月下人不归
我寻月下人不归 2021-02-02 09:53

I\'m writing an iPhone app in Objective-C with Xcode and I have some Lua scripts that run on the device.

I\'m having an issue where if I edit a Lua script, save, flick o

相关标签:
11条回答
  • 2021-02-02 10:29

    You should definitely add those files to your Xcode project. You can still edit them in your other editor, but Xcode will include them in your bundle automatically if you add it to the project. If they aren't getting copied when you build, this is how I resolve it:

    • Right click on the file in Xcode and choose "Touch" which updates the timedate stamp on the file, so it looks "new".

    • On the simulator, choose Reset Content and Settings from the File Menu.

    • In Xcode, do a Build Clean

    When you build and run after that it should install the file just fine.

    EDIT:

    To add external folders to your project that will get included in your bundle and preserve the folder structure intact, all you need to do is:

    • Click on the project icon at the top of the file list on the left.

    • Click the Project menu and Add to Project.

    • Select the folder you want to include and click Add.

    • Unchecked the Copy checkbox and change "Recursively create groups for any added folders" to "Create Folder References for any added folders".

    • When the target is built, open up the bundle and your directory structure will exist inside fully intact.

    0 讨论(0)
  • 2021-02-02 10:29

    I had a similar problem auto-copying a script file, when changed. Had set its Type to "C" to allow for auto syntax highlighting. Had added the file to "Build Phases / Copy Bundle Resources". But no luck; changes to the file would not update the bundle.

    The fix, in this case, was to change the Type from "C" to "JSON". Now, it updates the bundle automatically on the device. Makes sense, since source files are rarely needed for a binary. Originally, Apple didn't allow any scripting.

    enter image description here

    0 讨论(0)
  • 2021-02-02 10:31

    Sounds like you have an "one-off" kind of a problem, in which your updated scripts make it "too late" to the bundle. Have you tried changing the order of the build phases, in particular moving the copy phase not to be at the end but before the compile and link phases?

    0 讨论(0)
  • 2021-02-02 10:33

    Use Trouble Shooting

    Clean the Xcode Projects

    Build and Run

    0 讨论(0)
  • 2021-02-02 10:35

    For reasons I am yet to understand, sometimes the build process seems to get forgetful or simply unreliable.

    Usual troubleshooting for this type of scenario is to clean all in Xcode, and at the same time delete the app from the phone.

    0 讨论(0)
提交回复
热议问题