在 IOS 中通过 Linking.openURL React Native Open 设置
React Native Open settings through Linking.openURL in IOS
我想从我的应用程序中打开 ios 设置应用程序。设置目标是 [ settings => notification => myapp ]。打开和关闭推送通知。
有一些文档是关于如何link设置的,但是我不知道怎么打开deeplink。 (通知=>我的应用程序)。
我该怎么做?
您可以像这样深入link引用设置的索引:
Linking.openURL('app-settings:')
以上方法仅适用于IOS
要访问特定的设置屏幕,试试这个:
Linking.openURL("App-Prefs:root=WIFI");
链接到 app-settings
只会打开设置
参考:iOS Launching Settings -> Restrictions URL Scheme(注意iOS6中prefs
改为App-Prefs
)
使用Linking.openURL
。例如,下面是如何在 iOS
上检查和打开健康应用程序
import { Linking } from 'react-native'
async goToSettings() {
const healthAppUrl = 'x-apple-health://'
const canOpenHealthApp = await Linking.canOpenURL(healthAppUrl)
if (canOpenHealthApp) {
Linking.openURL(healthAppUrl)
} else {
Linking.openURL('app-settings:')
}
}
试试这个用于开放特定系统 URL - Linking.openURL('App-Prefs:{3}')
自 React Native 0.60 打开 App 设置使用:
import { Linking } from 'react-native';
Linking.openSettings();
打开应用程序的自定义设置(如果有的话)。
适用于 Android 和 iOS
试试这个
Linking.openURL('app-settings://notification/myapp')
对于 iOS 14,这是我打开位置服务设置的方式
Linking.openURL('App-Prefs:Privacy&path=LOCATION')
在 React Native 0.63.4 中测试
我想从我的应用程序中打开 ios 设置应用程序。设置目标是 [ settings => notification => myapp ]。打开和关闭推送通知。
有一些文档是关于如何link设置的,但是我不知道怎么打开deeplink。 (通知=>我的应用程序)。
我该怎么做?
您可以像这样深入link引用设置的索引:
Linking.openURL('app-settings:')
以上方法仅适用于IOS
要访问特定的设置屏幕,试试这个:
Linking.openURL("App-Prefs:root=WIFI");
链接到 app-settings
只会打开设置
参考:iOS Launching Settings -> Restrictions URL Scheme(注意iOS6中prefs
改为App-Prefs
)
使用Linking.openURL
。例如,下面是如何在 iOS
import { Linking } from 'react-native'
async goToSettings() {
const healthAppUrl = 'x-apple-health://'
const canOpenHealthApp = await Linking.canOpenURL(healthAppUrl)
if (canOpenHealthApp) {
Linking.openURL(healthAppUrl)
} else {
Linking.openURL('app-settings:')
}
}
试试这个用于开放特定系统 URL - Linking.openURL('App-Prefs:{3}')
自 React Native 0.60 打开 App 设置使用:
import { Linking } from 'react-native';
Linking.openSettings();
打开应用程序的自定义设置(如果有的话)。
适用于 Android 和 iOS
试试这个
Linking.openURL('app-settings://notification/myapp')
对于 iOS 14,这是我打开位置服务设置的方式
Linking.openURL('App-Prefs:Privacy&path=LOCATION')
在 React Native 0.63.4 中测试