Open facebook page into facebook application Ios +

2019-05-14 05:48发布

问题:

Goal :- Open facebook page url into facebook application

I am using ionic version 1.6 I have tried

<a ng-click="openFb()">   
    <img src="img/fb.png" alt="" width="auto" height="auto">
</a>

In controller file i have my function below.

$scope.openFb = function() {  
    window.open('fb://page/1372537532795807', "_system");
 };

Above after searching lot i have found that if you wants to open page you have to pass fb:://page[page_id] than fb:://profile/[page_id]

But when i clicks on button nothing happens not even opening installed facebook application on my device.

Looking forward to have some help.

Thank you in advanced.

回答1:

Solution: Add URL Schemes to the Whitelist

Simply open your app's .plist (usually platforms/ios//-Info.plist) with an editor and add the following code with your needed Schemes.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
</array>

Apple changed the canOpenURL method on iOS 9. Apps which are checking for URL Schemes on iOS 9 and iOS 10 have to declare these Schemes as it is submitted to Apple. The article Quick Take on iOS 9 URL Scheme Changes expains the changes in detail.

Reference link :- https://github.com/ohh2ahh/AppAvailability/issues/22