2

Anyone know how to launch native apps on iOS from a NativeScript app using the app URL schemes? These URLs are returning false and not launching the apps as expected when using openUrl via the NativeScript utils module.

  1. Facebook - openUrlModule.openUrl("fb://profile/<profileid>")
  2. Instagram - openUrlModule.openUrl("instagram://app")
  3. Youtube - openUrlModule.openUrl("youtube://app")

Any help is greatly appreciated.

Todd
  • 5,538
  • 1
  • 31
  • 34
francorobles
  • 41
  • 1
  • 7

2 Answers2

3

While this has been discussed in the NativeScript Slack Channel, capturing answer here for others that have similar challenges.

In iOS 9, Apple requires apps to whitelist the URL schemes they are allowed to open. This requires an additional key in the Info.plist.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>{SCHEME NAMES HERE}</string>
    <string>fb</string>
    <string>...</string>
</array>

In NativeScript, add this key to the Info.plist in the app > App_Resources > iOS directory (if you're using the CLI).

(If you're using Telerik AppBuilder, modify the Info.plist by right-clicking on your project name in the project explorer and then Edit Configuration > iOS Info.plist. This generates a Info.plist with all default settings in the App_Resources directory.)

See this StackOverflow post for more detail on the new key in iOS9: iOS 9 not opening Instagram app with URL SCHEME

Hope that helps.

Community
  • 1
  • 1
Todd
  • 5,538
  • 1
  • 31
  • 34
0

Code seems the same (Android) https://github.com/NativeScript/NativeScript/blob/1ad23a3a78bbf95e2b89a82d9473498ee0dda350/tns-core-modules/utils/utils.android.ts#L299

https://stackoverflow.com/a/11114413/1368333

Although they use a different url scheme it seems

Community
  • 1
  • 1
Steve McNiven-Scott
  • 1,770
  • 2
  • 15
  • 29