Simulate startup options

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); } 
+4
source share
1 answer

(Suppose you are using Xcode 4.x)

Product -> Edit Scheme... , and under Run <appname>.app there is a Launch option on the first tab ( Info ). Select Wait for <appname.app> to start. Now, when you build and run (or just run), the debugger will wait for you to launch the application manually.

+12
source

Source: https://habr.com/ru/post/1389252/


All Articles