Reputation: 185
I have created my own framework which has storyboard. I have imported the framework in my project but when I tried to access the storyboard from framework with below code I am getting error
"Exception: Could not find a storyboard named 'AssignTasks' in bundle NSBundle".
can we have UI in framework? can anyone help me here?
NSBundle *bundleName = [NSBundle bundleWithIdentifier:@"bundle id of framework"];
UIStoryboard *stainStoryboard = [UIStoryboard storyboardWithName:@"AssignTasks" bundle: bundleName];
self.assignTasksListView = (AssignTasksListView*)[stainStoryboard instantiateViewControllerWithIdentifier: @"AssignTasksListView"];
Upvotes: 1
Views: 1420
Reputation: 6982
What you need to do is make sure you're using the correct bundle and that your storyboard file is copied to the bundle.
Select the Storyboard file and on the right, in File Inspector, make sure you've selected Target Membership
and used your Framework. Or, alternatively, go to your project settings, to Build Phases > Copy Bundle resources
and make sure the storyboard file is there.
The bundle identifier can be found Project Settings > Build Settings > Product Bundle Identifier
.
Or, alternatively, you can programmatically grab the correct bundle, provided the storyboard is in the same bundle as one of your Framework classes
NSBundle *bundle = [NSBundle bundleForClass:[OneOfYourFrameworkClasses class]];
Upvotes: 1