Xcode will not let go of the resource file

Today my question is how Xcode deals with resource files in the bundled application that it creates. I know this may be trivial, but I cannot find an easy way out. Basically my problem is that Xcode seems to continue to include a resource file (like a text file) in the application bundle, even if the file was deleted from the project. It describes in detail what is happening here.

⁃ Added a file to the project (both by choosing file - new file or dragging a file to the Xcode groups and files left column checking add to project folder if needed checkbox) ⁃ Compiled and launched the project in simulator ⁃ Verified that the file is present in myApp.app bundle, located in User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even in <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app ⁃ Deleted the file from groups and files column in Xcode ⁃ Deleted the actual file with Finder in <my Xcode projects folder>/myApp/myFile ⁃ Deleted User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app ⁃ Emptied the trash ⁃ Verified that there is no reference to the file with Finder spotlight ⁃ Verified that there is no reference to the file with Xcode search ⁃ Rebuilt and relaunched the app in simulator ⁃ Verified that a brand new /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app has been just created ⁃ Verified the content of /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app bundle: the file is still there. Where the h. did Xcode take it from? 

Of course, I missed something really obvious. Any help?

+4
source share
7 answers

Have you checked the "Goals" node? If not, then

  • Expand the Goals node and one application.
  • There must be a build phase called "Bundle Copy Resources".
  • Verify that the resource is not in phase.

You can also try a complete cleanup of the project to ensure that temporary files are not available.

+6
source

The net used to work in xcode 3, but it does not seem to do anything in 4. I found that removing the application from the test device seems to help make the resource disappear.

+2
source

This problem arose a few days ago.

It turned out that under 3.2 the simulator creates several application folders, one for each version of the SDK. I have:

 ~/Library/Application Support/iPhone Simulator/3.0 ~/Library/Application Support/iPhone Simulator/3.1.2 ~/Library/Application Support/iPhone Simulator/3.1.3 ~/Library/Application Support/iPhone Simulator/3.2 ~/Library/Application Support/iPhone Simulator/User 

If you compile under a different SDK, it creates a new application directory for the application in the folder for the new SDK. I had the alias of the old folder, and I ended up in the wrong folder in the version of the application that Xcode no longer aimed and therefore never changed. IIRC, I had to track the new application in the corresponding SDK folder.

+1
source

I had the same problem. However, the solution proposed in the answer did not solve my problem. In Targets> Copy Bundle Resources, I don’t see ghost files. I tried to do a full cleanup, uninstall the application and reinstall it, and I still have the files in my application. The solution I found was manually deleting the contents of the folder: ~ / Library / Application \ Support / iPhone \ Simulator / 4.3 / Applications /

+1
source

Remove the application from the simulator and use finder to delete the directory of your application in the library> Developer> Xcode> DerivedData.

+1
source

I had a similar problem. Xcode 4 continues to complain about the lack of a resource file, even if it was removed from the project. This results in a build error.

Here's how it resolved:

1) Open the .pbxproj file 2) Delete all lines that refer to the resource file you want to get rid of 3) Build it

+1
source

I had a similar problem with a .scnassets file. .scnassets copy resources only list the .scnassets file (the real folder, not the group), but also remembers and copies its contents, even if they were deleted. Intentional cleaning corrects this. Moreover, files deleted from .scnassets ghost files seem to be copied every time the application is launched, and not the first time they are needed. Cleaning speed increases by 300%!

0
source

Source: https://habr.com/ru/post/1306801/


All Articles