美文网首页
ReactNative iOS-Linking的一些基本系统设置

ReactNative iOS-Linking的一些基本系统设置

作者: 以德扶人 | 来源:发表于2017-08-23 16:44 被阅读374次

    每个应用都有自己的url scheme,根据这个scheme就可以跳转。例如微信,可以写 weixin:// 进行跳转。
    在ReactNative,可以用Linking 进行连接跳转,下面列举了一些常用的跳转,最后面那个具体功能在iOS9后面基本废弃了,我蛮复制过来。

    用法

    1. 导入:import {Linking} from 'react-native';
      2.直接使用: 就像打电话可以这样Linking.openURL('tel:'+'电话号码');
    appstore  itms-apps://
    日历 calshow://
    时钟
        world clock  clock-worldclock://
        alarm clock-alarm://
        stopwatch clock-stopwatch://
        timer clock-timer://
    通讯录 contact://
    applewatch  itms-watch://
    facetime
        facetime视频 facetime://${PHONE}
        facetime确认视频 facetime-prompt://${PHONE}
        facetime音频 facetime-audio://${PHONE}
        facetime确认音频 facetime-audio-prompt://${PHONE}
    find friends findmyfriends://
    find iphone fmip1://
    gamecenter gamecenter://
    ibooks ibooks://
    iclouddrive iclouddriveapp://
    itunes itms://
    邮件
        打开邮件app message://
        写邮件 mailto:
        发送电子邮件 mailto:${EMAIL}?cc=&subject=${SUBJECT}&body=${BODY}
    地图
        打开地图app http://maps.apple.com/?q=
        获取地图路线 http://maps.apple.com/?saddr=${SADDR}&daddr=&{DADDR}
        搜索地图 http://maps.apple.com/?q=${QUERY}&near=${NEAR}
    信息
        写信息 sms://
        发送信息 sms:${PHONE}
        群发信息 launcher://msg?to=${PHONE}&subject=${SUBJECT}&body=${BODY}
    音乐 music://
    新闻 applenews://
    备忘录 mobilenotes://
    电话
        打开电话app mobilephone://
        拨打电话 tel:${PHONE}
        要求确认拨打 telprompt:${PHONE}
    照片 photos-redirect://
    播客 pcast://
    提醒事项 x-apple-reminder://
    safari x-web-search://
    视频 videos://
    语音备忘录 voicememos://
    wallet shoebox://
    天气 weather://?index=0
    

    注意,类似${PHONE}这样的代表需要参数,可以设定具体值,
    tel:${PHONE} 具体到拨打10086
    tel:10086

    插入一个跳转qq的功能:
    //Linking为RN自带的组件
    let url = "mqqwpa://im/chat?chat_type=wpa&uin=12313";//调用QQ
    //let url = "tel: 电话号码";//调用拨号
    Linking.canOpenURL(url).then(supported => {
    if (supported) {
    Linking.openURL(url);
    }
    });
    }

    跳转到设置比较特殊,它里面可以有很多细分跳转(因为后面iOS加入了权限设置,所以基本都失效了)

    About — prefs:root=General&path=About
    Accessibility — prefs:root=General&path=ACCESSIBILITY
    Airplane Mode On — prefs:root=AIRPLANE_MODE
    Auto-Lock — prefs:root=General&path=AUTOLOCK
    Brightness — prefs:root=Brightness
    Bluetooth — prefs:root=General&path=Bluetooth
    Date & Time — prefs:root=General&path=DATE_AND_TIME
    FaceTime — prefs:root=FACETIME
    General — prefs:root=General
    Keyboard — prefs:root=General&path=Keyboard
    iCloud — prefs:root=CASTLE
    iCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP
    International — prefs:root=General&path=INTERNATIONAL
    Location Services — prefs:root=LOCATION_SERVICES
    Music — prefs:root=MUSIC
    Music Equalizer — prefs:root=MUSIC&path=EQ
    Music Volume Limit — prefs:root=MUSIC&path=VolumeLimit
    Network — prefs:root=General&path=Network
    Nike + iPod — prefs:root=NIKE_PLUS_IPOD
    Notes — prefs:root=NOTES
    Notification — prefs:root=NOTIFICATIONS_ID
    Phone — prefs:root=Phone
    Photos — prefs:root=Photos
    Profile — prefs:root=General&path=ManagedConfigurationList
    Reset — prefs:root=General&path=Reset
    Safari — prefs:root=Safari
    Siri — prefs:root=General&path=Assistant
    Sounds — prefs:root=Sounds
    Software Update — prefs:root=General&path=SOFTWARE_UPDATE_LINK
    Store — prefs:root=STORE
    Twitter — prefs:root=TWITTER
    Usage — prefs:root=General&path=USAGE
    VPN — prefs:root=General&path=Network/VPN
    Wallpaper — prefs:root=Wallpaper
    Wi-Fi — prefs:root=WIFI
    

    相关文章

      网友评论

          本文标题:ReactNative iOS-Linking的一些基本系统设置

          本文链接:https://www.haomeiwen.com/subject/lzxjdxtx.html