facebook深度链接文档以及测试工具:https://developers.facebook.com/docs/app-ads/deep-linking
1.首先需要集成facebook的FBSDKCoreKit库(pod 'FBSDKCoreKit')
在didFinishLaunchingWithOptions中初始化facebook sdk并设置深度链接
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
//此代码在您的应用启动时初始化SDK,并允许SDK在执行“登录”或“共享”操作时处理来自本地Facebook应用的结果
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
//设置延迟深度链接
if (launchOptions[UIApplicationLaunchOptionsURLKey] == nil) {
[FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
if (error) {
NSLog(@"Received error while fetching deferred app link %@", error);
}