move xcode project causes red text (missing files from project)

后端 未结 13 1199
有刺的猬
有刺的猬 2020-12-08 13:53

When I move iphone project directory to a new path. There are some red texts indicate the missing files from the project source codes. How to avoid these?

相关标签:
13条回答
  • 2020-12-08 14:40
    1. In Finder, create a duplicate of the project directory just in case all goes squiffy.
    2. In Finder, open the project directory that contains all the files with red references
    3. For all the red files you see in XCode, except the info.plist file (see step 5 below), highlight them in Finder and drag them from Finder to XCode's project navigator. i.e. import them.
    4. In XCode's "Choose options for adding these files" window: a) Select Copy items into Destination's group folder (if needed) b) Select Create groups for any added folder c) Select Add to Targets, and press Finish
    5. Highlight and drag the info.plist file from Finder to Project Navigator and repeat step 4 WITHOUT selecting Add to Targets
    6. If you had groups in Project Navigator (e.g. Supporting Files), reorder the files to be in the right places.
    7. Delete the original bad red references in Project Navigator, and Cmd-Shift-K to clean for good measure.
    8. Build and run on a device to remove the bad reference to the .app file
    0 讨论(0)
  • 2020-12-08 14:48

    When you create these files be sure to save in your app directory. Or if you import classes from other project be sure to check the copy option.

    0 讨论(0)
  • 2020-12-08 14:48

    Did you move files in to folders directly in your project folder and not in xcode?

    0 讨论(0)
  • 2020-12-08 14:51

    I had the same problem, when I changed the permission on the files/folders to everyone read/write they then appeared in Xcode.

    0 讨论(0)
  • 2020-12-08 14:52

    I dont know if this is the main reason but when you are importing files to the application, do you mary the "Copy items in to destination group's folder (if needed)" ?

    this make sure the file is not only referenced but added to your project folder and ir will move any where you move your project.

    0 讨论(0)
  • 2020-12-08 14:53

    It's too simple to do : Close the project that includes the missed files and open the Xcode, go to "Organizer">"Projects" and remove the project from the list there. Open your project from Finder and that's it.

    hope this help.

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