模拟启动选项 [英] Simulate Launch Options
问题描述
在我的 appDelegate
中,当应用程序使用来自ie邮件应用程序的文件启动时,我有一些规范。
in my appDelegate
, I have some specifications when the App is launch with a File from i.e. Mail app.
当我启动我的应用程序,一切正常。当我通过邮件从文件启动应用程序时,应用程序崩溃。不幸的是,我无法调试,因为我无法模拟 launchchingOptions
。在这一刻,我建立并运行,然后断开iPad,关闭我的应用程序,然后去邮件等...有没有办法调试?
When I launch my App, everything works normal. When I launch the App via File from Mail, the App crashes. Unfortunately, I am not able to debug it as I can't simulate launchingOptions
. at the moment, I build and run, then disconnect the iPad, close my App and then go to mail etc … Is there a way to debug?
Appdelegate 。($)
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);
}
推荐答案
(猜测你使用Xcode 4 .x)
(Guessing you use Xcode 4.x)
产品 - >编辑方案...
和运行< appname> .app
有启动
选项(信息
)。选择等待< appname.app>
启动。现在当你执行build&运行(或只是运行),调试器将等待您手动启动应用程序。
Product -> Edit Scheme...
and under Run <appname>.app
there is Launch
option in first tab (Info
). Select Wait for <appname.app>
to launch`. Now when you perform build & run (or just run), debugger will wait for you to launch the app manually.
这篇关于模拟启动选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!