2

I have an ios app that I am modifying so that it can simply plug-in to a series of other apps as a static library. However, I also need to have all the corresponding resources as well, so I created a custom bundle to include these. The bundle includes all the tab bar images, localizable strings, default images, and, most importantly for this question, the storyboard files. When I run the app, it can't find the storyboard files in the custom bundle.

My project is layed out as follows: Hmmmm...ok, it seems I cannot post an image until my reputation score increases, and since I'm a first-timer...I'll do my best to describe it instead.

The static library project is dragged into the master project as a sub-project. The static sub-project includes 2 targets, the library, which generates the libOMPhotoGalleryLibrary.a file, and the libraryResources, which creates the OMPhotoGalleryLibraryResources.bundle file. The Copy Bundle Resources section of the resource's Build Phases includes (along with a bunch of images and strings files):

  • MainStoryboard_iPad.storyboard in OMPhotoGalleryLibraryResources/(localization).lproj

  • MainStoryboard_iPhone.storyboard in
    OMPhotGalleryLibraryResources/(localization).lproj

The master project then includes the static .a file of the sub-project in the Linked Frameworks and Libraries section and the custom bundle is included in it's Copy Bundle Resources.

When I run the project, I get the message: Could not find a storyboard named 'MainStoryboard_iPhone' in bundle NSBundle

OK, this is not totally unexpected since I need to figure out how to tell the app to look in the custom bundle instead.

As a debug exercise, I (temporarily) added references in the main project directly to the storyboard files and could get everything to work. So, I know that the static library is working properly, and that the bundle is deployed and images and localizable strings are deployed and accessible. So, after removing the temporary references in the main project, the runtime can no longer find the storyboard files again.

I've tried to adjust the storyboard file names in the info section of the master project to each of the following to no avail: OMPhotoGalleryLibraryResources.bundle/MainStoryboard_iPhone OMPhotoGalleryLibraryResources.bundle/en/MainStoryboard_iPhone OMPhotoGalleryLibraryResources.bundle/en.lproj/MainStoryboard_iPhone

I've also tried several programmatic approaches in the app delete of the master project, but also with no luck. So, I'm not sure how to tell the app to look for the storyboard file in the OMPhotoGalleryLibraryResources.bundle. I can successfully read all the other files from this bundle once the storyboard loads.

otago
  • 31
  • 1
  • 4

1 Answers1

1

UPDATE 03/03/2013: Solved it. I was on the right track, but the files that I brought over from the original project were in the localized folder en.lproj. However, I didn't localize them in the new sub-project. When I pulled the files out of the en.lproj folder and into the root resources folder, and then changed the INFO references to OMPhotoGalleryLibraryResources.bundle/MainStoryboard it worked.

otago
  • 31
  • 1
  • 4
  • 2
    I want to do exact same setup in project. but I can't load storyboard from resource bundle file. Are you able to create sample project and share it? It will be much appreciated. – Tsung Lin Tsai Nov 17 '13 at 20:26