简体   繁体   English

iOS canOpenURL返回true,但未安装应用程序(facebook)

[英]iOS canOpenURL returns true, but app is not installed(facebook)

Currently, I want to check in my app whether Facebook App is installed or not. 目前,我想检查我的应用程序是否已安装Facebook App。

What am I doing: 我在做什么:

UIApplication.shared.canOpenURL(URL(string: "fb://")!)enter code here

In URL Schemes I have added fb, so not missed that part too. 在URL方案中,我添加了fb,所以也不要错过该部分。

But canOpenURL RETURNS TRUE ! 但是canOpenURL返回TRUE But the app IS UNinstalled. 但是该应用程序未安装。 I restarted the device, not helped. 我重新启动设备,没有帮助。 Why this is happening? 为什么会这样呢? UPDATE: some code 更新:一些代码

if UIApplication.shared.canOpenURL(URL(string: "fb://")!) {
    self.shareToFacebook(with: completion)
} else {
    progressVC.dismiss(animated: false, completion: nil)
    UIApplication.shared.open(URL(string: "https://itunes.apple.com/us/app/facebook/id284882215")!)
}

SOLUTION: I found the solution people. 解决方案:我找到了解决方案的人。 In URL types I had been added fb45....(id of my app), and also added fb, which one shouldn't be there, I removed fb, and only kept the one with id, so the openURL now returns false if the app is not installed 在URL类型中,我已经添加了fb45 ....(我的应用程序的ID),还添加了fb,这个不应该在那里,我删除了fb,只保留了ID,所以openURL现在返回false如果未安装该应用程序

You need to add fb to the LSApplicationQueriesSchemes array in the app plist, not the URL schemes array, like so: 您需要将fb添加到应用程序plist中的LSApplicationQueriesSchemes数组中,而不是URL schemes数组中,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 canOpenURL 返回 true 并且应用程序已安装但应用程序未打开 - canOpenURL return true and app is installed but app is not opening 即使未安装应用程序,canOpenURL 也会为自定义 URL 方案返回 true - canOpenURL returning true for custom URL scheme even if app is not installed Linking.canOpenURL 为 IOS 返回 true,为 Android 返回 false:React Native - Linking.canOpenURL returns true for IOS and false for Android : React Native 即使已安装Facebook App,canOpenURL:facebookAppURL也会返回false - canOpenURL:facebookAppURL return false, even if Facebook App is installed iOS9 Facebook登录canOpenURL错误 - iOS9 Facebook Login canOpenURL error 安装Facebook应用程序的Facebook SDK iOS登录 - Facebook SDK iOS login with Facebook app installed 如果安装了Facebook应用,iOS Facebook授权失败 - iOS Facebook Authorize failing if Facebook app is installed 安装Facebook应用程序时身份验证失败(iOS) - Authentication Fails with Facebook App Installed (iOS) Facebook 登录套件,带有 iOS 13“canOpenURL:URL 失败:“fbauth2:///” - Facebook Login kit with iOS 13 "canOpenURL: failed for URL: “fbauth2:///”" 应用程序配置错误,安装Facebook登录IOS Facebook应用程序 - App is misconfigured for Facebook login IOS Facebook app installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM