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

后端 未结 13 1198
有刺的猬
有刺的猬 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:54

    If you create an Xcode project, then move the .xcodeproj file or the newly created project folder to a different folder using Finder, subsequent builds may show many missing files which still reference the original folder locations (which no longer exist because you moved them). These missing files can appear as red text or as issues in the Issue Navigator.

    This can happen when Xcode is configured to automatically add or remove files to/from source control (under Xcode > Preferences > Source Control). When configured this way, simply creating a project in Xcode causes new project folders and files to be marked for addition to source control. When you later move the project folder or .xcodeproj file these pending adds now point to missing files.

    To resolve this issue when Subversion is the source control program, revert the pending adds for the phantom items from your local working copy folder. In my case this requires dropping into a Terminal window, navigating to the parent of the phantom project folder, then reverting the automatic add, e.g.

    cd /my-working-copy-folder
    svn status --depth infinity
    svn status --depth infinity existing-parent-folder/phantom-project-folder/
    svn revert --depth infinity existing-parent-folder/phantom-project-folder/
    

    Note that the first svn status command will list both missing files as well as properly added, modified or deleted files which you must take care to avoid reverting. The second status command is "practice" for the final revert command, to ensure you've specified the proper path to revert.

    I do not know git but I assume it offers corresponding commands.

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