Platform-Knowledge-Base/troubleshooting/cannot-open-custom-url-sche...

57 строки
2.0 KiB
Markdown
Исходник Обычный вид История

2016-10-05 17:52:57 +03:00
---
2016-10-05 18:33:57 +03:00
title: Deep Linking Does Not Work on iOS Devices
2016-10-05 17:52:57 +03:00
description: Opening an external app from an iOS app using a custom URL scheme doesn't work
type: troubleshooting
2016-10-05 18:33:57 +03:00
page_title: Links with Custom URL Schemes Do Not Work on iOS Devices
2016-10-05 17:52:57 +03:00
slug: deep-linking-not-working-on-ios-devices
position:
tags: deep linking, custom url scheme, googlegmail, comgooglemaps, iOS
ticketid: 1062970
---
## Environment
<table>
<tr>
<td>Service</td>
2016-10-05 18:33:57 +03:00
<td>{{site.ab-s}} ({{site.ab}})</td>
2016-10-05 17:52:57 +03:00
</tr>
<tr>
<td>Feature</td>
2016-10-05 18:33:57 +03:00
<td>Run on Device</td>
2016-10-05 17:52:57 +03:00
</tr>
<tr>
<td>Mobile development type</td>
2016-10-05 18:33:57 +03:00
<td>Hybrid ({{site.ac}} app)</td>
</tr>
<tr>
<td>Mobile OS</td>
<td>iOS</td>
2016-10-05 17:52:57 +03:00
</tr>
</table>
## Description
2016-10-05 18:33:57 +03:00
Links in your app, that use a custom URL scheme (for example, `googlegmail://`) to open an external app, do not work on iOS. Clicking such a link produces no visible result. This problem is observed on iOS 9 and newer versions.
2016-10-05 17:52:57 +03:00
## Cause
Apple introduced a new `LSApplicationQueriesSchemes` key in the iOS `Info.plist` file that lists the URL schemes the app is able to open. If this property is not set in your app, you will not be able to link using any custom URL schemes.
## Solution
You need to whitelist all custom URL schemes that you intend to use in your app. To do this, follow the steps below:
2016-10-05 18:33:57 +03:00
1. In {{site.ab}}, right-click your project name and select **Edit Configuration** -> **iOS Info.plist**.
2016-10-05 17:52:57 +03:00
2. Add the following right before the last closing `</dict>` tag:
```
<key>LSApplicationQueriesSchemes</key>
<array>
<string>customscheme</string>
<string>customscheme</string>
<string>customscheme</string>
</array>
```
2016-10-05 18:33:57 +03:00
where you replace `customurlscheme` with the names of the custom URL schemes that you want to use. For example, `fb`, `googlegmail`, `comgooglemaps`.
2016-10-05 17:52:57 +03:00
3. Save and re-build your app.
## See Also
* [iOS Launch Services Keys Documentation](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html)