How to open my app on device by clicking on facebook feed in ios

I want to open my app when I click on a message shared by my app to facebook on an iOS device.

If there is any example please provide me.

+3


source to share


2 answers


First create a deeplink url from this link " https://developers.facebook.com/quickstarts/1555401071407647/?platform=app-links-host ". And it will return url like @ " https://fb.me/16753168070237260 ". add this to your FBGraphObject like this



NSMutableDictionary <FBOpenGraphObject> *object =  [FBGraphObject openGraphObjectForPostWithType:@"myApp:event"                                                    title:@"testing title"                                                    image:nil                                                      url:@"https://fb.me/16753168070237260"                                              description:@""];

      

+2


source


Add the following line to your project plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.test.DEMO</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>DEMO</string>
        </array>
    </dict>
</array>

      

Whenever you open the "DEMO: //" url in your phone browser, it will open your app if already installed (use your app name instead of DEMO)

So either you can send "DEMO: //" with your facebook post, so when you click "DEMO: //" it will open a link in the browser which will open your app or save it to a server file and open that file using the following code



save the following code in a php file and save that file on the server and send the url of the file (which will open this php file from your server) with your Facebook post or news feed, so when you click on the given link it will be

  <?php
    echo "<script>setTimeout(function() { \n
         window.location = \"https://itunes.apple.com/us/app/DEMO...\";\n
         }, 25);\n
         window.location = \"DEMO://?l=1\";\n
    </script>";

  ?>

      

Now that your application is open from the browser, if you want to perform any operation, you need to add the following method to your delegate class

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    //add your code
}

      

0


source







All Articles