2016-06-15 3 views
0

내가 내 응용 프로그램 위임 그렇게URL 단축키 (내 앱의 pdf 열기)를 통해 내 앱에 들어가면 제 제스처가 재조정되지 않는 이유는 무엇입니까?

//tableView:cellForRowAtIndexPath: 
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]; 
[cell addGestureRecognizer:lpgr]; 

처럼 설정 jQuery과의 제스처를 가지고, 그래서

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
if (url == nil) { 
    NSLog(@"Shortcut: None"); 
    return NO; 
} 
NSLog(@"Shortcut: %@", [url absoluteString]); 

    NSURLComponents *urlC = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO]; 
    if ([urlC.scheme isEqualToString:@"file"]) { //file:///private/var/mobile/...../Documents/Inbox/file.pdf 

     FSCategoriesTVC *FSCategoriesTVC = [_window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"FSCategoriesTVC"]; 
     FSCategoriesTVC.isUploadingFile = YES; 
     FSCategoriesTVC.fileToUpload = url; 
     FSCategoriesTVC.navigationItem.prompt = @"Select project to add files to"; 

     UINavigationController *navController = [[UINavigationController alloc] init]; 
     [navController setViewControllers:@[FSCategoriesTVC] animated:NO]; 

     if(_window.rootViewController.presentedViewController != nil) { 
      [_window.rootViewController dismissViewControllerAnimated:NO completion:^{ }]; 
     } 
     [_window.rootViewController presentViewController:navController animated:NO completion:^{}]; 
     return YES; 
    } 
return NO; 
} 

처럼 바로 가기를 처리하고있어 내가에서 .PDF 파일을 여는하고 있어요 내 응용 프로그램과 S3에 업로드하여 나중에 보게. 그러나 응용 프로그램이 이런 식으로 시작하면 내 제스처는 인식되지 않습니다

e : 제스처를 BAMContextualMenu라는 프레임 워크로 대체하여 제 문제를 해결할 수 있기를 바랍니다. 바로 가기

답변

0
  1. 에서 시작할 때 application:openURL:sourceApplication:annotation:이기 때문에 동일한 문제가, 제스처는
  2. 대신 application:willFinishLaunchingWithOptions:의 URL을 처리 시도의 URL을 열 때 뷰 계층이 다른 경우 볼 수있는 뷰 디버거를 시도 인식되지 않습니다 더 이상 사용되지 않습니다. UIApplicationLaunchOptionsURLKey 키를 사용하여 옵션 사전에서 URL을 검색 할 수 있습니다. 그렇게하면 URL이 있는지 여부와 관계없이 같은 코드로 뷰 계층 구조를 초기화 할 수있게됩니다. 내 경험에 따르면 훨씬 더 안전 할 수 있습니다. application:openURL:options:을 구현할 수도 있습니다.
+0

내가보기에 유일한 것은'UITransitionView'입니다. http://imgur.com/a/VDZcu – lizzy81

+0

거기에 명백한 붉은 깃발이 보이지 않습니다. 나는 두 번째 제안을 추가했다. –

+0

두 번째 제안을 지금 보았습니다. xcode에서 나에게 소리를 지르기 때문에'application : openURL : sourceApplication : annotation :'은 더 이상 사용되지 않습니다. 이 시험을 아프다. – lizzy81