Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I found a question on Stack Overflow in which someone suggested that the asker look in the application's bundle to verify that the file that the asker's application was unable to access is actually in the bundle. He said to look in the "Products" subfolder of the app's derived data folder. When I did that for my app, though, I saw nothing except for a Debug folder and a Release folder.

Will someone please help me? Thanks.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Couple thoughts:

In your project under Products, right click your app and choose Show in Finder.
In your app delegate try this: NSLog(@"%@", [[NSBundle mainBundle] bundlePath]);

Do they give the same answer?

Let us know how it goes.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
Couple thoughts:

In your project under Products, right click your app and choose Show in Finder.
In your app delegate try this: NSLog(@"%@", [[NSBundle mainBundle] bundlePath]);

Do they give the same answer?

Let us know how it goes.
Please enlighten me. If I put in that NSLog, what should I see in the log?
Edit: I'll do it, but I just want to know what we're looking for.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
Couple thoughts:

In your project under Products, right click your app and choose Show in Finder.
In your app delegate try this: NSLog(@"%@", [[NSBundle mainBundle] bundlePath]);

Do they give the same answer?

Let us know how it goes.

I just added an NSLog statement. Here's what the log says:
2015-07-28 15:08:59.507 Reading Expressway[1350:73674] Bundle path: /Users/montana/Library/Developer/CoreSimulator/Devices/F5D48000-D286-422D-B37F-F306178A0890/data/Containers/Bundle/Application/1175723A-1EA5-45B9-9C64-C1CBE3C7F2F9/(app name).app

The (app name).app file is colored in red in Xcode, and clicking "Show in Finder" opens up to the "Products" folder. As expected, there is no (app name).app file in the window.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
That path you showed is where the installed app bundle is. You can open it from the Terminal:

open "/Users/montana/Library/Developer/CoreSimulator/Devices/F5D48000-D286-422D-B37F-F306178A0890/data/Containers/Bundle/Application/1175723A-1EA5-45B9-9C64-C1CBE3C7F2F9/(app name).app"

and then see the files inside it.

Your app name.app bundle should be in the Debug-iphoneos, Debug-iphonesimulater and any other Products folders in there. Are you saying that you can build and run but there's nothing in any of those folders inside Products?
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
That path you showed is where the installed app bundle is. You can open it from the Terminal:

open "/Users/montana/Library/Developer/CoreSimulator/Devices/F5D48000-D286-422D-B37F-F306178A0890/data/Containers/Bundle/Application/1175723A-1EA5-45B9-9C64-C1CBE3C7F2F9/(app name).app"

and then see the files inside it.

Your app name.app bundle should be in the Debug-iphoneos, Debug-iphonesimulater and any other Products folders in there. Are you saying that you can build and run but there's nothing in any of those folders inside Products?
There is the .app file in Debug-iphonesimulator. It's just that when I right-click (app name.app) inside Xcode and select "Show in Finder", I get a "Products" folder with nothing in it besides a "Debug" folder and a "Release" folder.

And yes, the app is being run in the simulator.

Edit: Quick question: I'm trying to copy and paste the full path into Terminal. However, since the app's name consists of two words separated by a space, Terminal immediately assumes I want to open two separate files named "app" and "name" (these are just example words, btw) and therefore complains that it can't find files with those names. How do I fix this?
 
Last edited:

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
There is the .app file in Debug-iphonesimulator. It's just that when I right-click (app name.app) inside Xcode and select "Show in Finder", I get a "Products" folder with nothing in it besides a "Debug" folder and a "Release" folder.

And yes, the app is being run in the simulator.

Edit: Quick question: I'm trying to copy and paste the full path into Terminal. However, since the app's name consists of two words separated by a space, Terminal immediately assumes I want to open two separate files named "app" and "name" (these are just example words, btw) and therefore complains that it can't find files with those names. How do I fix this?

OK, so I decided not to use Terminal. Instead, I went to the app bundle's location in Finder via the "Go to Folder" dialog. Then, I right clicked the .app file and clicked "Show Package Contents". Once I did that, everything in the app showed up, including the file that was supposedly not in the bundle.

Off-topic: I recommend that everyone who reads this Webpage bookmark it in their favorite browser so that they can easily refer back to it in the future.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I guess that Xcode sometimes doesn't show the correct folder when you choose 'Show in Finder' but it does show a parent of the folder you want to see. Inside the folder it shows you it should show the .app bundle.

I guess you didn't notice the double quotes in the open command I showed. Double quotes are one way of escaping spaces in paths in Terminal.

This should work with the double quotes (regardless of spaces or other special characters):

open "/Users/montana/Library/Developer/CoreSimulator/Devices/F5D48000-D286-422D-B37F-F306178A0890/data/Containers/Bundle/Application/1175723A-1EA5-45B9-9C64-C1CBE3C7F2F9/(app name).app"

iOS developers should learn how to use Terminal and the various un*x commands on Mac OS X.
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I guess that Xcode sometimes doesn't show the correct folder when you choose 'Show in Finder' but it does show a parent of the folder you want to see. Inside the folder it shows you it should show the .app bundle.

I guess you didn't notice the double quotes in the open command I showed. Double quotes are one way of escaping spaces in paths in Terminal.

This should work with the double quotes (regardless of spaces or other special characters):

open "/Users/montana/Library/Developer/CoreSimulator/Devices/F5D48000-D286-422D-B37F-F306178A0890/data/Containers/Bundle/Application/1175723A-1EA5-45B9-9C64-C1CBE3C7F2F9/(app name).app"

iOS developers should learn how to use Terminal and the various un*x commands on Mac OS X.
Oh, that's the trick. The quotes.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.