国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS 隱私權限和通過openURL實現跳轉實例

2019-10-21 18:46:06
字體:
來源:轉載
供稿:網友

iOS 10之后蘋果對于用戶隱私方面要求非常嚴格,曾經幫朋友發布純H5的APP,由于使用第三方而未加隱私權限都不讓提交App Store。這邊就是給大家列舉下蘋果對于最為常見的隱私以及平時我們開發是會用到的openUrl這方法所用到的key。

一、隱私權限

當然有朋友會說,不加隱私,讓他奔潰后再log中找就好了,通常會導致奔潰的可以這樣做,但是例如定位什么的就不會產生奔潰,直接是定位不出結果的,這時候就需要自己拼寫了。

ios,跳轉隱私,隱私權限,ios10隱私權限設置

<key>NSPhotoLibraryUsageDescription</key> <string>訪問相冊</string><key>NSCameraUsageDescription</key> <string>訪問相機</string> <key>NSContactsUsageDescription</key><string>訪問通訊錄</string><key>NSMicrophoneUsageDescription</key> <string>訪問麥克風</string> <key>NSAppleMusicUsageDescription</key> <string>訪問媒體資料庫</string><key>NSLocationUsageDescription</key> <string>訪問位置</string> <key>NSLocationWhenInUseUsageDescription</key> <string>使用期間訪問位置</string> <key>NSLocationAlwaysUsageDescription</key> <string>始終訪問位置</string> <key>NSCalendarsUsageDescription</key> <string>訪問日歷</string> <key>NSRemindersUsageDescription</key> <string>訪問提醒事項</string> <key>NSMotionUsageDescription</key> <string>訪問運動與健身</string> <key>NSHealthUpdateUsageDescription</key> <string>訪問健康更新 </string> <key>NSHealthShareUsageDescription</key> <string>訪問健康分享</string> <key>NSBluetoothPeripheralUsageDescription</key> <string>訪問藍牙</string> <key>NSSiriUsageDescription</key><string>訪問Siri</string> <key>NSSpeechRecognitionUsageDescription</key><string>訪問語音識別</string>

以上只是列舉了比較常見的。平時開發中,和手機數據交互,但代碼沒有問題,出現無端bug時可以考慮下是不是隱私權限問題。

二、openUrl

開發中使用以下代碼可以實現快速撥打電話

  NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];  if (phoneVersion.floatValue < 10.0) {    //iOS10 以前使用    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Tel://123456"]];  }  else {    //iOS10 以后使用    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"Tel://123456"]                      options:@{}                 completionHandler:nil];  }

只要給出對應的URL,系統就可以直接跳:

//撥打電話[NSURL URLWithString:@"tel://123456"] //發送短信[NSURL URLWithString:@"sms://123456"]//發郵件[NSURL URLWithString:@"mailto://123456@163.com"]//前往App Store[NSURL URLWithString:@"itms-apps://"]//使用Safari訪問網址[NSURL URLWithString:@"http://www.baidu.com"]//前往iBook[NSURL URLWithString:@"itms-books://"]//發起Facetime[NSURL URLWithString:@"facetime://"]//8、調用 地圖Map[NSURL URLWithString:@"maps://"]//9、調用 Music[NSURL URLWithString:@"music://"]//10、跳轉到系統設置相關界面  // iOS10 以前  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION"] options:@{} completionHandler:nil];  // iOS10 以后  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=LOCATION"] options:@{} completionHandler:nil];#pragma mark - 以下為跳轉設置的對應方式//設置[NSURL URLWithString:UIApplicationOpenSettingsURLString]//iCloud[NSURL URLWithString:@"App-Prefs:root=CASTLE"]//WIFI[NSURL URLWithString:@"App-Prefs:root=WIFI"]//藍牙[NSURL URLWithString:@"App-Prefs:root=Bluetooth"]//蜂窩數據[NSURL URLWithString:@"App-Prefs:root=MOBILE_DATA_SETTINGS_ID"]//通知[NSURL URLWithString:@"App-Prefs:root=NOTIFICATIONS_ID"]//通用[NSURL URLWithString:@"App-Prefs:root=General"]//關于手機[NSURL URLWithString:@"App-Prefs:root=General&path=About"]//輔助功能[NSURL URLWithString:@"App-Prefs:root=General&path=ACCESSIBILITY"]//日期與時間[NSURL URLWithString:@"App-Prefs:root=General&path=DATE_AND_TIME"]//鍵盤設置[NSURL URLWithString:@"App-Prefs:root=General&path=Keyboard"]//顯示與亮度[NSURL URLWithString:@"App-Prefs:root=DISPLAY"]//墻紙設置[NSURL URLWithString:@"App-Prefs:root=Wallpaper"]//聲音[NSURL URLWithString:@"App-Prefs:root=Sounds"] //Siri[NSURL URLWithString:@"App-Prefs:root=Siri"]//隱私[NSURL URLWithString:@"App-Prefs:root=Privacy"]//定位[NSURL URLWithString:@"App-Prefs:root=Privacy&path=LOCATION"]//電池電量[NSURL URLWithString:@"App-Prefs:root=BATTERY_USAGE"]//iTunes Store 與 App Store[NSURL URLWithString:@"App-Prefs:root=STORE"]

三、總結

本文只是記錄,方便以后自己查找,有遺漏的歡迎大家指出。以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到IOS開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 达日县| 柳林县| 长岛县| 甘孜县| 达拉特旗| 长丰县| 监利县| 芮城县| 舞钢市| 晋宁县| 澄江县| 阿合奇县| 东台市| 广灵县| 喀什市| 大新县| 定襄县| 荥阳市| 铜陵市| 三穗县| 临猗县| 额济纳旗| 九龙坡区| 五台县| 乌兰察布市| 张家口市| 和平区| 南和县| 金昌市| 神农架林区| 威宁| 凉城县| 合肥市| 林芝县| 静安区| 敦煌市| 乌拉特中旗| 新乡县| 黄冈市| 新田县| 黄冈市|