in my appDelegate , I have some specifications when an application is launched using the File from ie Mail application.
When I run my application, everything works fine. When I launch the application through File from Mail, the application crashes. Unfortunately, I cannot debug it, because I cannot simulate launchingOptions . at the moment I create and launch, and then turn off the iPad, close the application and go to mail, etc. Is there any way to debug?
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); }
source share