がappDelegate
になっているので、アプリがMailアプリからのファイルで起動されたときに仕様がいくつかあります。起動オプションをシミュレートする
アプリを起動すると、すべて正常に機能します。メールからファイル経由でアプリケーションを起動すると、アプリケーションがクラッシュします。残念ながら、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);
}
コンソールは、そのデバイスの[オーガナイザ]ウィンドウに表示されませんか? – deanWombourne
私はあなたが何を意味するか分かりません... – Faser
私はあなたがNSLogがWindow-> Organizerから出力しているものを見ることができることを意味しました。しかし、@ fichekの答えは私の考えよりも非常に良いです:) – deanWombourne