我正在嘗試在Storyboard上完成IOS 5.1上的應用程序。基本上我正在做一個Dropbox應用程序。由於我使用Dropbox SDK鏈接到Dropbox,因此在AppDelegate.m中處理。用戶可以選擇從會話中取消鏈接,並在不同的視圖控制器中重新鏈接。所以每次用戶鏈接和未連接的應用程序必須從AppDelegate中切換視圖到視圖控制器未連接到RootViewController的如何在AppDelegate中執行Segue?
在原來的Dropbox的例子Dropbox的處理,像下面的代碼
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
[navigationController pushViewController:rootViewController.photoViewController animated:YES];
}
return YES;
}
return NO;
}
過渡,但我現在用故事板與導航控制器和以下任何方法都無法正常工作我將方法放在註釋中。
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(@"App linked successfully!");
// At this point you can start making API calls
/*UIViewController *viewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:@"MeetingViewController"];
[self.navigationController pushViewController:viewController animated:YES]; */
//[self performSegueWithIdentifier:@"xxxx" sender:self];
/* LoginDropboxViewController *loginController=[[LoginDropboxViewController alloc] initWithNibName:@"LoginDropbox" bundle:nil];
[navigationController pushViewController:loginController animated:YES]; */
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
這裏是應用
所以,我怎麼可以切換視圖AppDelegate.h的故事板?
注意:如果我添加一個segue並命名segue讓我們說goToMeeting [self performSegueWithIdentifier:@「goToMeeting」sender:self];
錯誤我得到的是:No Visible @interface for 'AppDelegate' declares the selector performSegueWithIdentifier:sender
但是,如果我需要將參數數據傳遞給performSegueWithIdentifier調用,我該怎麼辦。在應用程序委託沒有ViewController,所以我不能覆蓋prepareForSegue()調用? – ChaosSpeeder