dlinsin / cocoapods-storyboard-sample

How to create cocoapods with localized storyboards
https://github.com/CocoaPods/CocoaPods/issues/2597
MIT License
2 stars 2 forks source link

'Could not find a storyboard named 'TestLocalization' in bundle NSBundle #2

Open skyhacker2 opened 8 years ago

skyhacker2 commented 8 years ago

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'TestLocalization' in bundle NSBundle </var/mobile/Containers/Bundle/Application/71BDE25B-517D-442D-86CC-156E9167368D/Example.app> (loaded)'

silkroadnomad commented 7 years ago

I head the same issue! I think the problem is the podspec! Use this instead:

s.resource_bundles = {
    'storyboards-sample' => ['Pod/**/*.{lproj,storyboard}']
}

Also the DetailsViewController in line 46 I changed to:

- (IBAction)press:(id)sender {

   /* UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"TestLocalization" bundle:[NSBundle mainBundle]];
    UIViewController *testController = [storyboard instantiateInitialViewController];
    [self presentViewController:testController animated:YES completion:nil];*/

    NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle bundleForClass:[self class]] URLForResource:@"storyboards-sample" withExtension:@"bundle"]];

  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"TestLocalization"
                                                         bundle:bundle];

    UIViewController *testController = [storyboard instantiateInitialViewController];
    [self presentViewController:testController animated:YES completion:nil];
}