How to add files to a .bundle file in xcode - xcode

I am working on an iOS application that I did not create and I would like to add some audio and image assets to the project. Right now these are all located in a .bundle file and accessed like this:
[[NSBundle mainBundle] pathForResource:#"MyBundle.bundle/some_audio" ofType:#"m4a"]
My question is, how do I add new assets to MyBundle.bundle? I have located MyBundle.bundle in the project navigator and on the filesystem but I can't figure out how to add files.

I figured it out:
Locate the .bundle in Finder (in XCode you can right click and select "Show in Finder")
Right click the .bundle and choose "Show Package Contents"
Drag files into the new finder window that opens

Related

Accidentally made asset folder into "app bundle" how do I undo this??? Xcode

I misclicked an option when I had my assets folder open in Xcode and now the screen where you drag and drop files into app icons etc isn't there, how do I get it back?When I click on the assets folder all I get is this dropdown menu now.

Xcode 10 does not show file in Navigation Pane

When I click on a folder in the Navigation pane, and open it in Finder, the file is there, but it's not shown in Xcode and build fails complaining the file doesn't exist. Is there a way to "Refresh" the file structure (the way you would in IntelliJ) or can I only do a drag*drop to fix it?
When I click on a folder in the Navigation pane, and open it in Finder, the file is there, but it's not shown in Xcode and build fails complaining the file doesn't exist.
The project navigator doesn't show you the file system, it shows you the files included in the project. If you need to include a file in the project, then you'll need to add it. You can do that by dragging it into the project, or with the File->Add Files To "..." menu command.

Storyboard file suddenly missing in Xcode

Somehow my storyboard file won't load in my Xcode project. I see the storyboard in the app project from finder, but when I open the Xcode project it's missing and it's red. I tried dragging the file in but it wouldn't show up in Xcode. What's wrong?
Sounds like your directory structure changed without updating the pbxproj file so the filepath is broken. Click on each affect file, open the Utilities pane to the File Inspector, click on the folder icon and select the file in the Finder window that comes up to restore the path.

How to consistently add files to a bundle in Xcode?

I'm not able to consistently add files to a bundle package. I recall once being able to drag images from one place and right into the bundle in finder, but right now, anything I try to drag into the bundle goes right back to its original location. If I try to copy/paste a file into the bundle the file gets placed at the same level as the .bundle package in Finder.
How I open the bundle:
In Xcode navigation area, right-click on myBundleName.bundle
Select 'Show in Finder'
In finder, right-click on myBundleName.bundle
Select 'Show Package Contents'
Question 1: How to add a file to this bundle?
Question 2: Why does it seem that I'm sometimes able to add files and sometimes not?
Sidenote: I am able to delete files from the bundle.

Xcode: How to add a file to a folder reference

I want to add a file to an existing folder in Xcode. I have a folder in the file system that I have added to my resources. Now when I add a file to that folder, and try to drag and drop that file onto the folder reference in Xcode, I am out of luck.
Even if I delete the reference and drag the whole folder over again, it does not work, as it imports all files that were in the folder when I originally imported it, but not the new ones.
Any ideas on that one?
Drag it into that folder in Finder, then right click that blue folder in Xcode and then "touch" it. Or collapse and expand that folder icon (is like touching it).

Resources