zoukankan      html  css  js  c++  java
  • iOS 10 跳转系统设置

      苦心人天不负, 为了项目终于把 iOS 10 跳转系统设置的方法给搞定了, 很欣慰.

      http://www.cnblogs.com/lurenq/p/6189580.html

    方法一:

      iOS 10 跳转系统设置的字段

    • 电池电量 Prefs:root=BATTERY_USAGE
    • 通用设置 Prefs:root=General
    • 存储空间 Prefs:root=General&path=STORAGE_ICLOUD_USAGE/DEVICE_STORAGE
    • 蜂窝数据 Prefs:root=MOBILE_DATA_SETTINGS_ID
    • Wi-Fi 设置 Prefs:root=WIFI
    • 蓝牙设置 Prefs:root=Bluetooth
    • 定位设置 Prefs:root=Privacy&path=LOCATION
    • 辅助功能 Prefs:root=General&path=ACCESSIBILITY
    • 关于手机 Prefs:root=General&path=About
    • 键盘设置 Prefs:root=General&path=Keyboard
    • 显示设置 Prefs:root=DISPLAY
    • 声音设置 Prefs:root=Sounds
    • App Store 设置 Prefs:root=STORE
    • 墙纸设置 Prefs:root=Wallpaper
    • 打开电话 Mobilephone://
    • 世界时钟 Clock-worldclock://
    • 闹钟 Clock-alarm://
    • 秒表 Clock-stopwatch://
    • 倒计时 Clock-timer://
    • 打开相册 Photos://

    // 此方法审核会被拒

    Guideline 2.5.1 - Performance - Software Requirements Your app uses or references the following non-public APIs: LSApplicationWorkspace

    Guideline 2.5.1 - Performance - Software Requirements


    Your app uses or references the following non-public APIs:

    LSApplicationWorkspace

    The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

    Next Steps

    To resolve this issue, please revise your app to remove any non-public APIs. If you have defined methods in your source code with the same names as the above-mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your app being flagged in future submissions.

    Additionally, if you are using third-party libraries, please update to the most recent version of those libraries. If you do not have access to the libraries' source, you may be able to search the compiled binary using the "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These tools can help you narrow down where the problematic code resides. You could also use the "nm" tool to verify if any third-party libraries are calling these APIs.

      1 + (void)encryptMethodGoToSystermSetting:(NSString *)setting {
      2 
      3     NSString *encryptWork = [self encryptDefaultWork];
      4 
      5     NSString *encryptWiFi_Method = [self getGoToWIFI_Method];
      6 
      7     NSURL*url = [NSURL URLWithString:setting];
      8 
      9     Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");
     10 
     11     [[LSApplicationWorkspace performSelector:NSSelectorFromString(encryptWork)]
     12 
     13      performSelector:NSSelectorFromString(encryptWiFi_Method)
     14 
     15      withObject:url
     16 
     17      withObject:nil];
     18 
     19 }
     20 
     21 - (void)encryptMethodGoToSettingWiFi {
     22 
     23     NSString *encryptWork = [self encryptDefaultWork];
     24 
     25     NSString *encryptWiFi_Method = [self getGoToWIFI_Method];
     26 
     27     NSURL*url = [NSURL URLWithString:@"Prefs:root=WIFI"]; 
     28 
     29     Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");
     30 
     31     [[LSApplicationWorkspace performSelector:NSSelectorFromString(encryptWork)]
     32 
     33                              performSelector:NSSelectorFromString(encryptWiFi_Method)
     34 
     35                              withObject:url
     36 
     37                              withObject:nil];
     38 
     39 }
     40 
     41  
     42 
     43 // 利用ASCII值进行拼装组合方法
     44 
     45 -(NSString *)encryptDefaultWork{
     46 
     47     NSData *data_encrypted = [NSData dataWithBytes:(unsigned char []){0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x57,0x6f,0x72,0x6b,0x73,0x70,0x61,0x63,0x65} length:16];
     48 
     49     NSString *method = [[NSString alloc] initWithData:data_encrypted encoding:NSASCIIStringEncoding];
     50 
     51     return method;
     52 
     53 }
     54 
     55  
     56 
     57 -(NSString *)getGoToWIFI_Method{
     58 
     59     
     60 
     61     NSData *data_encrypted_one = [NSData dataWithBytes:(unsigned char []){0x6f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x6e, 0x73, 0x69,0x74, 0x69,0x76,0x65,0x55,0x52,0x4c} length:16];
     62 
     63     NSString *key_encrypted_one = [[NSString alloc] initWithData:data_encrypted_one
     64 
     65                                                     encoding:NSASCIIStringEncoding];
     66 
     67     NSData *data_encrypted_Two = [NSData dataWithBytes:(unsigned char []){0x77,0x69,0x74,0x68,0x4f,0x70,0x74,0x69,0x6f,0x6e,0x73} length:11];
     68 
     69     NSString *key_encrypted_two = [[NSString alloc] initWithData:data_encrypted_Two
     70 
     71                                                     encoding:NSASCIIStringEncoding];
     72 
     73     NSString *method = [NSString stringWithFormat:@"%@%@%@%@",key_encrypted_one,@":",key_encrypted_two,@":"];
     74 
     75     return method;
     76 
     77 }
     78 
     79 #pragma mark - 获取苹果私有的APi方法
     80 
     81 - (void)getiOSPrivateAPi{
     82 
     83     NSString *className = NSStringFromClass(NSClassFromString(@"LSApplicationWorkspace") /* [UIView class] */);
     84 
     85     
     86 
     87     const char *cClassName = [className UTF8String];
     88 
     89     
     90 
     91     id theClass = objc_getClass(cClassName);
     92 
     93     
     94 
     95     unsigned int outCount;
     96 
     97     
     98 
     99     Method *m =  class_copyMethodList(theClass,&outCount);
    100 
    101     
    102 
    103     NSLog(@"%d",outCount);
    104 
    105     
    106 
    107     for (int i = 0; i<outCount; i++) {
    108 
    109         
    110 
    111         SEL a = method_getName(*(m+i));
    112 
    113         
    114 
    115         NSString *sn = NSStringFromSelector(a);
    116 
    117         
    118 
    119         NSLog(@"%@",sn);
    120 
    121     }
    122 
    123 }

    方法二: 此方法不会被拒

    1 NSString * urlString = @"App-Prefs:root=WIFI";
    2 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlString]]) {
    3     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
    4 }else {
    5 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[urlString stringByReplacingOccurrencesOfString:@"App-P" withString:@"p"]]];
    6 
    7 }
    当前iOS10/9支持的所有跳转,亲测可用(测试系统:10.2.1  9.3.2)
    跳转 写法
    无线局域网 App-Prefs:root=WIFI
    蓝牙 App-Prefs:root=Bluetooth
    蜂窝移动网络 App-Prefs:root=MOBILE_DATA_SETTINGS_ID
    个人热点 App-Prefs:root=INTERNET_TETHERING
    运营商 App-Prefs:root=Carrier
    通知 App-Prefs:root=NOTIFICATIONS_ID
    通用 App-Prefs:root=General
    通用-关于本机 App-Prefs:root=General&path=About
    通用-键盘 App-Prefs:root=General&path=Keyboard
    通用-辅助功能 App-Prefs:root=General&path=ACCESSIBILITY
    通用-语言与地区 App-Prefs:root=General&path=INTERNATIONAL
    通用-还原 App-Prefs:root=Reset
    墙纸 App-Prefs:root=Wallpaper
    Siri App-Prefs:root=SIRI
    隐私 App-Prefs:root=Privacy
    Safari App-Prefs:root=SAFARI
    音乐 App-Prefs:root=MUSIC
    音乐-均衡器 App-Prefs:root=MUSIC&path=com.apple.Music:EQ
    照片与相机 App-Prefs:root=Photos
    FaceTime App-Prefs:root=FACETIME

    #####################################################################################################################

    https://forums.macrumors.com/threads/manually-creating-settings-launchers-in-app-launching-apps.2037291/
    Settings
    App-Prefs:root
    Settings -> About
    App-Prefs:root=General&path=About
    Settings -> Accessibility
    App-Prefs:root=General&path=ACCESSIBILITY
    Settings -> Autolock
    App-Prefs:root=DISPLAY&path=AUTOLOCK
    Settings -> Background App Refresh
    App-Prefs:root=General&path=AUTO_CONTENT_DOWNLOAD
    Settings -> Battery Usage
    App-Prefs:root=BATTERY_USAGE
    Settings -> Bluetooth
    App-Prefs:root=Bluetooth
    Settings -> CallerID
    App-Prefs:root=Phone&path=CallerID
    Settings -> Cellular/Mobile
    App-Prefs:root=MOBILE_DATA_SETTINGS_ID
    Settings -> Compass
    App-Prefs:root=COMPASS
    Settings -> Control Center
    App-Prefs:root=ControlCenter
    Settings -> Date/Time
    App-Prefs:root=General&path=DATE_AND_TIME
    Settings -> Dictionary
    App-Prefs:root=General&path=DICTIONARY
    Settings -> Display/Brightness
    App-Prefs:root=DISPLAY
    Settings -> Do Not Disturb
    App-Prefs:root=DO_NOT_DISTURB
    Settings -> Facebook
    App-Prefs:root=FACEBOOK
    Settings -> Facetime
    App-Prefs:root=FACETIME
    Settings -> Flickr
    App-Prefs:root=FLICKR
    Settings -> Game Center
    App-Prefs:root=GAMECENTER
    Settings -> General
    App-Prefs:root=General
    Settings -> iCloud
    App-Prefs:root=CASTLE
    Settings -> iCloud Backup
    App-Prefs:root=CASTLE&path=BACKUP
    Settings -> iCloud Storage
    App-Prefs:root=CASTLE&path=STORAGE_AND_BACKUP
    Settings -> International
    App-Prefs:root=General&path=INTERNATIONAL
    Settings -> iTunes & App Store
    App-Prefs:root=STORE
    Settings -> Keyboard
    App-Prefs:root=General&path=Keyboard
    Settings -> Keyboard -> Keyboards
    App-Prefs:root=General&path=Keyboard/KEYBOARDS
    Settings -> Location Services
    App-Prefs:root=Privacy&path=LOCATION
    Settings -> Mail, Contacts, Calendars
    App-Prefs:root=ACCOUNT_SETTINGS
    Settings -> Manage Storage
    App-Prefs:root=General&path=STORAGE_ICLOUD_USAGE/DEVICE_STORAGE
    Settings -> Maps
    App-Prefs:root=MAPS
    Settings -> Messages
    App-Prefs:root=MESSAGES
    Settings -> Multitasking
    App-Prefs:root=General&path=MULTITASKING
    Settings -> Music
    App-Prefs:root=MUSIC
    Settings -> Music EQ
    App-Prefs:root=MUSIC&path=com.apple.Music:EQ
    Settings -> Notes
    App-Prefs:root=NOTES
    Settings -> Notifications
    App-Prefs:root=NOTIFICATIONS_ID
    Settings -> Passcode
    App-Prefs:root=PASSCODE
    Settings -> Personal Hotspot
    App-Prefs:root=INTERNET_TETHERING
    Settings -> Phone
    App-Prefs:root=Phone
    Settings -> Photos
    App-Prefs:root=Photos
    Settings -> Privacy
    App-Prefs:root=Privacy
    Settings -> Profiles
    App-Prefs:root=General&path=ManagedConfigurationList
    Settings -> Reminders
    App-Prefs:root=REMINDERS
    Settings -> Reset
    App-Prefs:root=General&path=Reset
    Settings -> Ringtone
    App-Prefs:root=Sounds&path=Ringtone
    Settings -> Safari
    App-Prefs:root=SAFARI
    Settings -> SIM/PIN
    App-Prefs:root=Phone&path=SIM%20PIN
    Settings -> Siri
    App-Prefs:root=SIRI
    Settings -> Sounds
    App-Prefs:root=Sounds
    Settings -> Software Update
    App-Prefs:root=General&path=SOFTWARE_UPDATE_LINK
    Settings -> Storage & iCloud Usage
    App-Prefs:root=General&path=STORAGE_ICLOUD_USAGE
    Settings -> Touch ID & Passcode
    App-Prefs:root=TOUCHID_PASSCODE
    Settings -> Twitter
    App-Prefs:root=TWITTER
    Settings -> Usage
    App-Prefs:root=General&path=USAGE
    Settings -> Videos
    App-Prefs:root=VIDEO
    Settings -> Vimeo
    App-Prefs:root=VIMEO
    Settings -> Volume Limit
    App-Prefs:root=MUSIC&path=com.apple.Music:VolumeLimit
    Settings -> VPN
    App-Prefs:root=General&path=VPN
    Settings -> Wallet & Apple Pay
    App-Prefs:root=PASSBOOK
    Settings -> Wallpaper
    App-Prefs:root=Wallpaper
    Settings -> Weibo
    App-Prefs:root=WEIBO
    Settings -> Wi-Fi
    App-Prefs:root=WIFI

  • 相关阅读:
    数码摄影技巧拍摄的基本概念
    数码相机摄影技巧入门
    linux syslog用法
    委托
    创建遮罩层
    通过javascript获取多种主流浏览器显示页面高度
    sql 工具文件
    正则表达试笔记
    过滤字符串中带的HTML代码
    分页程序
  • 原文地址:https://www.cnblogs.com/lurenq/p/6189580.html
Copyright © 2011-2022 走看看