Facebook not open page in app swift 3

纵饮孤独 提交于 2019-12-01 01:22:17

I can confirm that the code you are using does work. I placed it in a new project, installed it on my phone, and set the Info.plist values as follows:

My code is as follows:

There are a few reasons that your code may not have worked.

  • You may need to clean and rebuild your project to make sure that your changes in Info.plist load.
  • You may need to verify that you added the LSApplicationQueriesSchemes to Info.plist and that that is the plist that the application is set up to load.
  • You must run this on a real device as your simulator should not have Facebook installed.
  • Verify that Facebook is installed and up-to-date.
  • Make sure that you are running the most up-to-date version of Xcode and iOS.
  • If all else fails, delete the app and rebuild and reinstall it.

You can check that your Info.plist is correctly loading the Queries Schemes by going to the Project Editor's Info tab and looking to make sure that LSApplicationQueriesSchemes is there with the options specified:

If you call the “canOpenURL” method on a URL that is not in your whitelist, it will return “NO”, even if there is an app installed that has registered to handle this scheme. A “This app is not allowed to query for scheme xxx” syslog entry will appear.

If you call the “openURL” method on a URL that is not in your whitelist, it will fail silently. A “This app is not allowed to query for scheme xxx” syslog entry will appear.

So you have to put fb in LSApplicationQueriesSchemes in your info.plist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!