开发者

How to launch Facebook with Button

开发者 https://www.devze.com 2023-02-13 04:52 出处:网络
Hey friends I created a button on my app called: \"Find us on Facebook\". Right now I ran into a situation where I need the button to launch the Facebook application. I could really use some help such

Hey friends I created a button on my app called: "Find us on Facebook". Right now I ran into a situation where I need the button to launch the Facebook application. I could really use some help such as launching the facebook application, de开发者_高级运维tecting if there is a facebook application, and all the sorts of stuff like that, thanks


Some googling shows that the facebook app apparently registers to receive urls with the fb:// scheme. So you can construct a fb:// url (like, say fb://notes or something) and then ask the UIApplication object if it can open the URL. If it says that it can, then open it.


there is a tutorial and sample app at https://github.com/facebook/facebook-ios-sdk

Basically you need to try to call fb://profile/yourpageid to load the FB app on your page. The sample app shows you how to do this and fall back to loading in Safari if the app is not installed on the device.

0

精彩评论

暂无评论...
验证码 换一张
取 消