IOS开发—跳转到系统设置以及其他应用
来源:互联网 发布:游戏充值用什么软件 编辑:程序博客网 时间:2024/05/19 17:55
跳转到系统设置
跳转到系统设置首页
NSURL *url = [NSURL URLWithString:@"prefs:root="];if ([[UIApplication sharedApplication] canOpenURL:url]){ [[UIApplication sharedApplication] openURL:url];}
跳转到某个具体的系统设置项界面
以跳转到wifi设置界面为例:
NSURL *url = [NSURL URLWithString:@"prefs:root=WIFI"];if ([[UIApplication sharedApplication] canOpenURL:url]){ [[UIApplication sharedApplication] openURL:url];}
跳转到其他具体系统设置项界面只需修改 “root=” 后面的参数值即可。下面是可以跳转的系统设置界面的参数配置:
About — prefs:root=General&path=AboutAccessibility — prefs:root=General&path=ACCESSIBILITYAirplane Mode On — prefs:root=AIRPLANE_MODEAuto-Lock — prefs:root=General&path=AUTOLOCKBrightness — prefs:root=BrightnessBluetooth — prefs:root=General&path=BluetoothDate & Time — prefs:root=General&path=DATE_AND_TIMEFaceTime — prefs:root=FACETIMEGeneral — prefs:root=GeneralKeyboard — prefs:root=General&path=KeyboardiCloud — prefs:root=CASTLEiCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUPInternational — prefs:root=General&path=INTERNATIONALLocation Services — prefs:root=LOCATION_SERVICESMusic — prefs:root=MUSICMusic Equalizer — prefs:root=MUSIC&path=EQMusic Volume Limit — prefs:root=MUSIC&path=VolumeLimitNetwork — prefs:root=General&path=NetworkNike + iPod — prefs:root=NIKE_PLUS_IPODNotes — prefs:root=NOTESNotification — prefs:root=NOTIFICATIONS_IDPhone — prefs:root=PhonePhotos — prefs:root=PhotosProfile — prefs:root=General&path=ManagedConfigurationListReset — prefs:root=General&path=ResetSafari — prefs:root=SafariSiri — prefs:root=General&path=AssistantSounds — prefs:root=SoundsSoftware Update — prefs:root=General&path=SOFTWARE_UPDATE_LINKStore — prefs:root=STORETwitter — prefs:root=TWITTERUsage — prefs:root=General&path=USAGEVPN — prefs:root=General&path=Network/VPNWallpaper — prefs:root=WallpaperWi-Fi — prefs:root=WIFI
跳转到其他应用
以在A中打开B为例
对A的操作:
//跳转并传递了3个参数NSString *urlString = [NSString stringWithFormat:@"appB://username=%@&age=%@&address=%@",@"test123",@"100",@"上海市"];//由于url支持26个英文字母、数字和少数几个特殊字符,因此,对于url中包含非标准url的字符时,就需要对其进行编码。iOS中提供了函数stringByAddingPercentEscapesUsingEncoding对中文和一些特殊字符进行编码NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url];}
对B的操作:修改info.plist文件,为将要打开的app注册一个url协议,
在AppDelegate.m中操作A传过来的参数:
- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nonnull id)annotation{ NSString *urlStr = [[url absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; if ([urlStr hasPrefix:@"appB://"]) { urlStr = [urlStr stringByReplacingOccurrencesOfString:@"appB://" withString:@""]; NSArray *paramArray = [urlStr componentsSeparatedByString:@"&"]; NSMutableDictionary *paramsDic = [[NSMutableDictionary alloc] initWithCapacity:0]; for (int i = 0; i < paramArray.count; i++) { NSString *str = paramArray[i]; NSArray *keyArray = [str componentsSeparatedByString:@"="]; NSString *key = keyArray[0]; NSString *value = keyArray[1]; [paramsDic setObject:value forKey:key]; NSLog(@"key:%@ ==== value:%@", key, value); } } return NO;}
0 0
- IOS开发—跳转到系统设置以及其他应用
- iOS 应用内跳转到系统设置
- iOS 应用内跳转到系统设置
- iOS 应用内跳转到系统设置
- iOS 应用内跳转到系统设置
- iOS 应用内跳转到系统设置
- IOS应用内跳转到系统设置
- IOS应用内跳转到系统设置
- iOS开发 跳转到系统设置
- iOS开发 跳转到系统设置
- iOS在应用中跳转到系统设置界面
- iOS应用内跳转到系统设置推送开关
- iOS应用 跳转到系统的设置界面
- iOS 10 应用内跳转到系统设置
- iOS应用内跳转到系统设置页面
- iOS 跳转到系统设置
- iOS开发 跳转到系统对应app设置(ios8)
- iOS开发如何跳转到系统设置或功能?
- 多元分布和狄利克雷分布
- 一年又一年----15年的Summary
- 线程本地存储(Windows和Linux) http://blog.csdn.net/wzhwho/article/details/6427596
- Vector和iterator的使用心得
- leetcode之Flatten Binary Tree to Linked List
- IOS开发—跳转到系统设置以及其他应用
- 文本分类学习笔记(5)- KNN
- CentOS6.5下编译Hadoop-2.7.2
- OSG例子讲解之osgautotransform
- 航电OJ-1874畅通工程续
- iOS个人整理23-可视化编辑2-StoryBoard,segue跳转,可视化自定义cell
- 【蓝桥杯】小学生的“进位”数
- 集合的toString()方法源码解析
- 查看Linux系统的glibc版本