Question

I'm having problems getting the targetURL from a Facebook Open Graph story deep link on iOS.

I'm publishing a test story like this:

https://graph.facebook.com/me/myapp:checkin?method=POST&access_token=CAAGy9...&meal=http%3A%2F%myapp.com%2F..&fb%3Aexplicitly_shared=true

The response is:

{"id": "10100..."}

Looking at my profile, the story published correctly. Following the link goes in a browser goes to the web page. Everything works fine on Android.

The first strange thing is that on my iPad, [[call appLinkData] targetURL] is null. This is not a big problem because I can use originalQueryParameters.

The big problem is that on my iPhone, appLinkData is null, so I can't get anything about the deep link.

What could be wrong? Is there possibly some setting on my phone? And why doesn't targetURL work on the iPad?

Both devices are updated to iOS 7.1 and the latest Facebook app. I'm using the latest iOS SDK 3.13. I've also tried older versions and they all have the same problem. I've tried creating a new action and story as well as a completely separate app and the results are the same.

Here's more strangeness. Did a clean restore of my phone. Downloaded Facebook. Ran my app from Xcode. Now it works. Stop app. Make no changes. Run app from Xcode again. Now it doesn't work anymore. Nothing changed.

Here's what's in my AppDelegate.m:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation
{
    BOOL wasHandled = [FBAppCall handleOpenURL:url
                             sourceApplication:sourceApplication
                               fallbackHandler:^(FBAppCall *call) {
                                   NSLog(@"%@",call);
                                   NSLog(@"%@",[call appLinkData]);
                                   NSLog(@"%@",[[call appLinkData] targetURL]);
                                   NSLog(@"%@",[[call appLinkData] originalQueryParameters]);
                               }
                       ];

    return wasHandled;
}

This is what I get on the iPad:

2014-03-12 13:49:03.081 myapp[191:60b] <FBAppCall: 0x14e813d0, ID: 196B6395-875C-4C66...
 accesstoken: CAAGy9nn...
 appLinkData: <FBAppLinkData: 0x14e80910
 actionTypes: (
    "myapp:checkin"
)>
>
2014-03-12 13:49:03.084 myapp[191:60b] <FBAppLinkData: 0x14e80910
 actionTypes: (
    "myapp:checkin"
)>
2014-03-12 13:49:03.085 myapp[191:60b] (null)
2014-03-12 13:49:03.086 myapp[191:60b] {
    "access_token" = CAAGy9nn..;
    "action_object_map" = "[60768014...]";
    "action_ref_map" = "[]";
    "action_type_map" = "[\"myapp:checkin\"]";
    "expires_in" = 3600;
    "fb_action_types" = "myapp:checkin";
    "fb_source" = "other_multiline";
    "target_url" = "http://myapp.com/...";
}

This is what I get on the iPhone:

2014-03-12 12:55:04.714 myapp[256:60b] <FBAppCall: 0x15dc2e70, ID: 3B25045E-E5F7...
 accesstoken: CAAGy9nn..
>
2014-03-12 12:55:04.723 myapp[256:60b] (null)
2014-03-12 12:55:04.725 myapp[256:60b] (null)
2014-03-12 12:55:04.725 myapp[256:60b] (null)
Was it helpful?

Solution

I think this has something to do with my account. On my friend's phone with his account, it works. On my phone with his account, it works. It just doesn't work with my account. Maybe because I'm the developer of the app? Also, the exact same code works with my account on other apps. Strange.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top