views:

185

answers:

2

Hello everybody, My question today is about how Xcode deals with resource files in the app bundle which it creates. I know that it may be trivial, but I can't find an easy way out. Basically my problem is that Xcode seems to keep on including a resource file (eg a text file) in the app bundle even if the file has been removed from the project. Here it is 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?

I am surely missing something really obvious. Any help? Thanks.

+1  A: 

Have you checked the "Targets" node ? If not then;

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

You can also try to perform a full clean of the project to ensure that no temporary files stay.

Laurent Etiemble
Hi Laurent, and thank you for your attention. You mean check the Target as an option while adding the file to the project?
All right, solved. I performed a full clean (under Xcode build menu) and it solved the issue. Thanks a lot.
That's the trick. Xcode soes not track deleted resources and delete them from a standing build product; it will incrementally add new ones, but to delete you have to remove the build product (or do a full clean.)
cdespinosa
+1  A: 

Ran into a similar problem a few days ago.

It turned out that under 3.2, the simulator creates several application folders, one for each SDK version installed. 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 app within the folder for the new SDK. I had an alias to the old folder and ended up looking in the wrong folder at a version of the app that Xcode was no longer targeting and therefore never changing. IIRC, I had to track down the new app in the matching SDK folder.

TechZen
Hello TechZen, and thank you for your answer. It's a good point but it doesn't seem solve my issue. In fact I performed such a search without finding a myApp bundle without the deleted file. More, the myApp bundle I found has a creation date which is posterior to the deletion of the file...
Righto, this sprung to mind because I just ran into it.
TechZen