I am using facebook SDK , and when I am trying to invite friend via facbook by using fb invite deep linking.
NSDictionary * getParam = @{
@"access_token":accessToken,
@"fields":@"canonical_url",
@"pretty":@(YES),
};
NSString * getCanoicalURL = [NSString stringWithFormat:@"%@/%@",FB_CANONICAL_API, fbAPILinkID];
[self GET:getCanoicalURL parameters:getParam success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject)
{
NSError *error;
FacebookLink * getResult = [MTLJSONAdapter modelOfClass:[FacebookLink class] fromJSONDictionary:responseObject error:&error];
if (error)
{
handler(nil,error);
}
else
{
handler(getResult.canonicalUrl,nil);
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)
{
handler(nil,error);
}];
The below is my invite friend method it show successfully :
-(void)inviteFriend:(NSString*)canonicalUrl
{
FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL =[NSURL URLWithString:canonicalUrl];
[FBSDKAppInviteDialog showFromViewController:self withContent:content delegate:self];
}
But when I try to fetch for defer deep link it always null:
FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error)
{
NSLog(@"fetch defer app link :%@",url);
if (error) {
NSLog(@"Received error while fetching deferred app link %@", error);
}
if (url) {
[[UIApplication sharedApplication] openURL:url];
}
}];