2016-03-15 51 views

回答

0

檢查下面的FB代理的url方案。

NSURL *url = [NSURL URLWithString:@"fb://messaging?"]; 
if ([[UIApplication sharedApplication] canOpenURL:url]) { 
    //fb messenger is installed 
} 
else{ 
    //fb messenger not installed 
    } 
1

檢查下面FB代碼的url方案。 (SWIFT)

let post = String(format: "fb-messenger://") 
     let canOpenURL = UIApplication.sharedApplication().canOpenURL(NSURL(string: post)!) 
     if (canOpenURL) 
     { 
      //FB Messanger Installed 
     } 
     else 
     { 
      //FB Messanger Not Installed 
     } 

此外,在開始的iOS 9,您必須在您的info.plist LSApplicationQueriesSchemes。

Add IN Info.plist