Xcode4: Resource not in Documents folder?

Member
Posts: 48
Joined: 2011.03
Post: #1
Hi, whats the easiest way to tell if a resource has been added to an iPhone project/bundle?

I had no "Resources" group so I added my own and added a .dat file of my own format to that group. If I look in Build Phases there is a "Copy Bundle Resources" section which shows my file. So.. does this mean that the file will definitely be downloaded to the iPhone with the application??

I admit I may be having some problems opening the file within my application (I am definitely getting a NULL return for fopen() and I'm familiar with the fact that you have to specify the correct full path, but before I go down that route, I just wanted to make sure that I'm including my file as a resource correctly first).

Does it sound like I'm doing the right thing?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
You can view the files in your built application bundle by right-clicking on it in the Finder and selecting "Show Package Contents".
Quote this message in a reply
Member
Posts: 48
Joined: 2011.03
Post: #3
(Apr 9, 2011 02:21 PM)ThemsAllTook Wrote:  You can view the files in your built application bundle by right-clicking on it in the Finder and selecting "Show Package Contents".

OK, I'll navigate there and have a look. I think it will be missing though. I've just done a memory dump of the filepath I'm trying to open in the iPhone simulator. The /Users/blahblah/Documents subfolder actually contains nothing, so I'm not surprised its failing to open within the application.


Oh dear.. I can't even find the package or any of the compiled object files.. :-) I'm useless at programming on the Mac. :-)
(Apr 9, 2011 02:21 PM)ThemsAllTook Wrote:  You can view the files in your built application bundle by right-clicking on it in the Finder and selecting "Show Package Contents".

Yes my file is inside the package when I do "Show Package Contents".. so why is it missing from the Documents folder that the iPhone simulator is using?

Is also 'normal' for the build package to be stored in such a bizarre long location like this too?

Code:
/Users/pspark/Library/Developer/Xcode/DerivedData/TestApp10_iPod-fcmkufkcknppxgbadwqhiqxxonmi/Build/Products/Debug-iphonesimulator/TestApp10_iPod.app

I'd be far happier storing any Build output within my own project folder.

Anyway, if I manually copy my .dat file to the Documents folder, my application will load the file and work fine...

..so whats the catch? How do you ensure that resource files are copied into the Documents folder?
Quote this message in a reply
Member
Posts: 48
Joined: 2011.03
Post: #4
OK.. I've figured it out. I made the mistake of thinking that something thats included as a resource is automatically placed into the Documents folder on the target. I can open my app from the resource itself now and my app works.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C++ with SDL2 Framework: Loading .bmp files in same folder in XCode 5 on Mavericks exitcode 1 1,134 Feb 23, 2014 11:15 PM
Last Post: SethWillits
  Xcode4: Debugger - how do you view class members? SparkyNZ 4 7,305 Jul 4, 2011 03:08 PM
Last Post: bdsowers
  Windows utility that can read Mac resource files? MarkS 2 3,578 Sep 24, 2009 05:52 PM
Last Post: MarkS
  moving all folder project = error imaumac 2 3,009 Oct 13, 2008 08:46 AM
Last Post: imaumac
  Library/Preferences folder someone 5 5,904 May 17, 2007 10:31 AM
Last Post: millercdusa