반응형


didFinishLaunchingWithOptions 에 아래와 같이 코딩 해주면 iOS 앱 실행 시 URL을 받을 수 있다.



    //deep link
    NSURL *URL = [launchOptions valueForKey:UIApplicationLaunchOptionsURLKey];
    if (URL)
    {
        //NSLog( @"application didFinishLaunchingWithOptions %@", [URL absoluteString] );
        [[UIApplication sharedApplication] openURL:URL];
    }
    
    // Facebook 지연된 딥 링크와 앱 링크 
    if ( URL == nil )
    {
        [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
            if (error) {
                NSLog(@"Received error while fetching deferred app link %@", error);
            }
            if (url) {
                [[UIApplication sharedApplication] openURL:url];
            }
        }];
    }


앱이 실행 중일 때는 openURL 함수로 바로 들어 오지만 앱이 종료되어 있을 경우에는 반드시 위와 같이

코딩을 해주어야 Deep link를 사용 가능 하다.


반응형

+ Recent posts