在我的appDelegate
,我有一些規格,當應用程序啓動與文件從郵件應用程序。模擬啓動選項
當我啓動我的應用程序時,一切正常。當我通過郵件文件啓動應用程序時,應用程序崩潰。不幸的是,我無法調試它,因爲我無法模擬launchingOptions
。目前,我建立和運行,然後斷開iPad,關閉我的應用程序,然後去郵件等...有沒有一種方法來調試?
Appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *url = (NSURL *)[launchOptions valueForKey:UIApplicationLaunchOptionsURLKey];
IntroViewController *introViewController = (IntroViewController *)self.window.rootViewController;
if (url !=nil) {
if ([url isFileURL]) {
introViewController.fileUrl = url;
}
}
NSLog(@"%@",[url path]);
return YES;
}
IntroViewController
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog(@"Hello");
if (fileUrl != nil) {
IntroTableViewController* introTable = (IntroTableViewController *)segue.destinationViewController;
introTable.openedByURL = [fileUrl path];
TabBarController* tabBarController = (TabBarController *)segue.destinationViewController;
UINavigationController* navigationController = (UINavigationController *)[[tabBarController viewControllers] objectAtIndex:0];
TargetLSController* targetViewController = (TargetLSController *)[[navigationController viewControllers] objectAtIndex:0];
NSString *urlPath = [fileUrl path];
targetViewController.currentFilePath = urlPath;
NSLog(@"%@",urlPath);
}
}
- (void)viewDidAppear:(BOOL)animated
{
[self performSegueWithIdentifier:@"Launch" sender:self];
NSLog(@"%@",fileUrl);
}
您是否仍然可以在該設備的Organizer窗口中看到控制檯? – deanWombourne 2012-01-04 11:04:08
我不知道你的意思是什麼...... – Faser 2012-01-04 12:08:02
我的意思是你可以看到NSLog從Window-> Organizer輸出的內容。不過,@ fichek的回答比我的想法更好:) – deanWombourne 2012-01-04 12:11:20