我创建了一个包含故事板的 SDK。故事板中有 4-5 个视图控制器。如何访问SDK的storyboard?
这是我的代码:
- (void)openAppleInAppProvisionMain {
// NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.digiTech.apple.applewalletNFI"];
NSLog(@"Received from Main Kony Callback : %@", shManager.callBack);
NSLog(@"Received from Main Kony Data : %@", shManager.dictResponse);
NSLog(@"method is accessible in this way");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"WalletMain" bundle:bundle];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"CardsViewsController"];
[AppleWallet performSelectorOnMainThread:@selector(presentTheViewController:) withObject:vc waitUntilDone:YES];
[[NSNotificationCenter defaultCenter] postNotificationName:@"getCardsList" object:nil userInfo:shManager.dictResponse];
}
+ (void)presentTheViewController:(UIViewController *)vc {
if(vc) {
vc.modalPresentationStyle = UIModalPresentationFullScreen;
// [KonyUIContext onCurrentFormControllerPresentModalViewController:vc animated:YES];
}
}
通过这种方式,我可以访问此方法以及示例应用程序中的所有其他方法,但我无法将 SDK 的故事板加载到我的示例应用程序中。
我的故事板设置是这样的。
我尝试过更改捆绑包,但不起作用。
您的故事板不在主应用程序包中。
您可以尝试以下方式,其中
CardsViewsController
类预计将成为您 SDK 的一部分:
NSBundle *sdkBundle = [NSBundle bundleForClass:[CardsViewsController class]];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"WalletMain" bundle:sdkBundle];