Resolved Xcode 6: How do I view all files in my main bundle?

Discussion in 'iOS Programming' started by moonman239, Jul 28, 2015.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    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.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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.
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    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.
     
  4. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #4
    I just added an NSLog statement. Here's what the log says:
    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.
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    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?
     
  6. moonman239, Jul 28, 2015
    Last edited: Jul 28, 2015

    moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #6
    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?
     
  7. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #7
    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.
     
  8. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #8
    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.
     
  9. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #9
    Oh, that's the trick. The quotes.
     

Share This Page