How to remove reference of file Xcode?

微笑、不失礼 提交于 2019-12-05 02:40:57

Since the reference to those files needed to be removed, I tried creating the files again under the same name as those that I had removed manually and deleted them again through Xcode and selected remove references from the pop up.

After removing a subproject, the framework was always referenced in my code. To remove this framework I had to do these steps:

  • remove subproject (reference)
  • clean project
  • close xcode
  • remove all derived and cached data with this script run in applescript tool :

    tell application "Terminal"
        do script "rm -frd ~/Library/Developer/Xcode/DerivedData/*" 
        do script "rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"
    end tell
    

In my case, adding and removing the external frameworks and using Clean did not solve the problem. Going to Target > Build Settings > Search paths and removing the offending paths from Framework Search Paths and Library Search Paths did the trick.

I hit the same issue today. Due to git merge issue, I ended up with a image file removed, but reference to it still exists. To clarify, My intention was to remove the image.

The simple way to fix this would be using vim, or other text editors

vim PATH_TO_PROJECT/{#projectName}.xcodeproj/project.pbxproj

and do a search on the name of the file you deleted and just delete all search results there.

To be safe from this error, make sure you Remove Reference on the file first before making any changes (outside XCode) on that file like deleting in folder, renaming, etc..

To remove reference, in XCode, right click on the file then Delete. A pop-up will show asking if you want to move to trash or remove reference. However, that popup won't show if you made any changes before doing Delete on XCode.

Just a tip!

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