0

I have created a web page with HTML Content as described in the AppLinks demonstration and that link is : http://reittv.w3studioz.com/terms/terms1

I have enabled the deeplinking in facebook App Settings. now I am sharing the post on facebook using the below code :

{

[FBSession openActiveSessionWithPublishPermissions: [NSArray arrayWithObjects: @"publish_stream", nil] defaultAudience: FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler: ^(FBSession *session,FBSessionState status,NSError *error)
 {
     NSLog(@"---------------");
     if (error)
     {
         return;

     }
     else
     {
         [FBSession setActiveSession:session];
         NSLog(@"LOGIN SUCCESS");

         // Put together the dialog parameters

         NSArray* actionLinks = [NSArray arrayWithObjects:
                                 [NSDictionary dictionaryWithObjectsAndKeys:
                                  @"Scisser",@"name",
                                  @"http://reittv.w3studioz.com/terms/terms1",@"link",
                                  nil],
                                 nil];
         NSData *jsonData2 = [NSJSONSerialization dataWithJSONObject:actionLinks options:NSJSONWritingPrettyPrinted error:&error];
         NSString *actionLinksStr = [[NSString alloc] initWithData:jsonData2 encoding:NSUTF8StringEncoding];





         NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                        @"test", @"name",
                                        @"testCaption", @"caption",
                                        @"testDescription", @"description",
                                        @"http://reittv.w3studioz.com/terms/terms1", @"link",
                                        @"", @"picture",
                                        @"foo", @"ref",
                                        actionLinksStr, @"actions",
                                        nil];

         // Make the request
         [FBRequestConnection startWithGraphPath:@"/me/feed"
                                      parameters:params
                                      HTTPMethod:@"POST"
                               completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                                   if (!error)
                                   {
                                       // Link posted successfully to Facebook
                                       NSLog(@"Post was successfully shared on your Facebook timeline.");


                                       NSLog(@"%@",[NSString stringWithFormat:@"result: %@", result]);

                                       return;
                                   }
                                   else
                                   {
                                       // An error occurred, we need to handle the error
                                       // See: https://developers.facebook.com/docs/ios/errors
                                       NSLog(@"%@",[NSString stringWithFormat:@"%@", error.description]);

                                       return;
                                   }
                               }];

     }
 }];

}

Now When I am clicking on the post then it's opening the url in facebook app(whereas it should open my native app) and not detecting the meta tags(that was in header file of the html page) ? How can we make our appName to open the application ? I am really frustrated now from some days. Please help this out.

  • 1
    Currently `http://reittv.w3studioz.com/terms/terms1` replies with an HTTP status code 500 – that’s the first thing you’ve got to fix. After that, check your OG implementation using the debug tool, https://developers.facebook.com/tools/debug/ – CBroe Apr 24 '15 at 13:48
  • I think the url is opening a page that is in HTML and its already has meta tags that were described in applinks i.e. https://developers.facebook.com/docs/applinks/add-to-content – Rahul Narang Apr 27 '15 at 05:16
  • Doesn’t matter what you “think”, it matters what your server _does_ – and currently, it answers with a 500 status code. Use your browser’s developer tools network panel to see for yourself. – CBroe Apr 27 '15 at 05:43
  • Thanks. I can check the things now from the debugger link that you have provided – Rahul Narang Apr 27 '15 at 06:34
  • I have done that using that applink concept. Can we do the same when user clicks on via "AppName" in feeds same as Instagram ? – Rahul Narang May 06 '15 at 10:55
  • I have written a detailed solution document under this question: https://stackoverflow.com/questions/46266797/deeplink-solution-for-ios-and-android-apps-works-in-facebook – Mustafa Atalar Sep 17 '17 at 18:31

0 Answers0