呼び出しが着信したときにUIがどこにあるかわからないため、UIを既知の準備完了状態にする必要があります。準備をするには、タブバーへのハンドルが必要であり、詳細vcが検査することになっているモデルの部分へのURLのuniqueid。
これは次のようになります(既存のコードについて自由に推測できます)。
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
// get the ui to a known state
self.tabBarController.selectedIndex = kTHE_NAVIGATION_VC_INDEX;
UINavigationController *nav = (UINavigationController *)self.tabBarController.selectedViewController;
[nav popToRootViewControllerAnimated:NO];
// parse the url to get uniqueId
// the uniqueId specifies an object in your model that you want to have
// inspected by the detail view controller? you'll need that object...
MyObject *detailObject = [self.myModel objectWithUniqueId:uniqueId];
// the detail vc probably has an init like this?
DetailVC *detailVC = [[DetailVC alloc] initWithModel:detailObject];
[nav pushViewController:detailVC animated:YES];
}
編集
アプリデリゲートにそのtabBarControllerへのアクセスを許可するには、次のようなプロパティを設定できます。
// AppDelegate.h
@property (strong, nonatomic) UITabBarController *tabBarController;
// AppDelegate.m, after @implementation
@synthesize tabBarController=_tabBarController;
スプラッシュVCからメインアプリに移動するためにストーリーボードセグエを使用していますか?はいと思います。スプラッシュビューコントローラーからメインアプリへのセグエは複数ありますか?私はNOを推測するつもりです。これらの推測のいずれかが間違っている場合は、このコードを調整する必要があります...
// SplashViewController.m
#import "AppDelegate.h"
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UITabBarController *tabBarController = (UITabBarController *)[segue destinationViewController];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.tabBarController = tabBarController;
}