LSApplicationQueriesSchemes in info.plist


#1

I am working with a simple button that opens a facebook page in the facebook-app or fallback to the browser. However this requires LSApplicationQueriesSchemes set in info.plist as of iOS 9. How would i go about changing this when i use expo?


#2

Hey @kristian,

I believe you should be able to configure this with the infoPlist key in your app.json.

https://docs.expo.io/versions/latest/guides/configuration.html#infoplist

Cheers,

Adam


#3

odd i have tried this now but with no luck:

"ios": {
  "infoPlist": {
    "LSApplicationQueriesSchemes": ["facebook"]
  }
}

#4

Hey @kristian - I think what you’re doing should work. Could you provide a snack that reproduces the issue so that we can try to debug it?

Also maybe worth noting, it looks like that key (LSApplicationQueriesSchemes) is only required for the canOpenURL method, but it does not restrict the types of urls you can pass into openURL (I’m referring to this https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl?language=objc). Have you tried just calling openURL with your facebook link?


#5

Hi here is a snack https://snack.expo.io/ryAYKXNdf
Hope it makes sense. :slight_smile:


#6

Hi @kristian - a couple of things. First, note that this won’t work at all in the Expo client app, as the ios.infoPlist key in app.json only applies in standalone apps. Second, try doing

"ios": {
  "infoPlist": {
    "LSApplicationQueriesSchemes": ["fb"]
  }
}

instead. The value in LSApplicationQueriesSchemes needs to match the scheme of the URL you’re trying to open. (i.e. the part before ://)

Let me know if this helps!


#7

There is more documentation about this here.


closed #8

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.