84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
使用[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Privacy&path=LOCATION"]]在iOS9和8上可以成功跳转,但是在iOS10上无效。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Privacy&path=LOCATION"]]
iOS10的URL换掉了,具体参照 https://github.com/cyanzhong/...不过这个只在Widge里有效,App中无效。用其他办法也可以做到跳转,不过因为是私有API会通不过审核。
参考:http://stackoverflow.com/ques...
把prefs: 换成Prefs: 就可以了
在ios10中跳转到具体的比如wifi,位置开关等具体的设置界面都已经被列为私有的API了,不允许使用;ios10只能跳转到相应的APP设置界面:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
针对iOS10不跳转问题,其实iOS提供了一套未公开方法。但审核是一个问题,不过我们可以想办法绕过审核。
NSString * defaultWork = [self getDefaultWork];NSString * bluetoothMethod = [self getBluetoothMethod];NSURL*url=[NSURL URLWithString:@"Prefs:root=Bluetooth"];Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");[[LSApplicationWorkspace performSelector:NSSelectorFromString(defaultWork)] performSelector:NSSelectorFromString(bluetoothMethod) withObject:url withObject:nil];利用ASCII值进行拼装组合方法。这样可绕过审核。
-(NSString *) getDefaultWork{SData *dataOne = [NSData dataWithBytes:(unsigned char []) {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x57,0x6f,0x72,0x6b,0x73,0x70,0x61,0x63,0x65} length:16];NSString *method = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding];return method;}-(NSString *) getBluetoothMethod{NSData *dataOne = [NSData dataWithBytes:(unsigned char []){0x6f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x6e, 0x73, 0x69,0x74, 0x69,0x76,0x65,0x55,0x52,0x4c} length:16];NSString *keyone = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding];NSData *dataTwo = [NSData dataWithBytes:(unsigned char []){0x77,0x69,0x74,0x68,0x4f,0x70,0x74,0x69,0x6f,0x6e,0x73} length:11];NSString *keytwo = [[NSString alloc] initWithData:dataTwo encoding:NSASCIIStringEncoding];NSString *method = [NSString stringWithFormat:@"%@%@%@%@",keyone,@":",keytwo,@":"];return method;}上面是进入蓝牙界面的方法。也可以有其他的页面可以跳转。设置页面是@"@"Prefs:root=TETHERING",wifi是@"Prefs:root=WIFI"。注意Prefs的P是大写。这么写也有弊端,如果苹果的未公开方法一旦修改。我们必须重新进行修改。
参考我的另外一个回答:https://segmentfault.com/q/10...
iOS10的URL换掉了,具体参照 https://github.com/cyanzhong/...
不过这个只在Widge里有效,App中无效。
用其他办法也可以做到跳转,不过因为是私有API会通不过审核。
参考:http://stackoverflow.com/ques...
把prefs: 换成Prefs: 就可以了
在ios10中跳转到具体的比如wifi,位置开关等具体的设置界面都已经被列为私有的API了,不允许使用;ios10只能跳转到相应的APP设置界面:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
针对iOS10不跳转问题,其实iOS提供了一套未公开方法。但审核是一个问题,不过我们可以想办法绕过审核。
NSString * defaultWork = [self getDefaultWork];
NSString * bluetoothMethod = [self getBluetoothMethod];
NSURL*url=[NSURL URLWithString:@"Prefs:root=Bluetooth"];
Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");
[[LSApplicationWorkspace performSelector:NSSelectorFromString(defaultWork)] performSelector:NSSelectorFromString(bluetoothMethod) withObject:url withObject:nil];
利用ASCII值进行拼装组合方法。这样可绕过审核。
-(NSString *) getDefaultWork{
SData *dataOne = [NSData dataWithBytes:(unsigned char []) {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x57,0x6f,0x72,0x6b,0x73,0x70,0x61,0x63,0x65} length:16];
NSString *method = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding];
return method;
}
-(NSString *) getBluetoothMethod{
NSData *dataOne = [NSData dataWithBytes:(unsigned char []){0x6f, 0x70, 0x65, 0x6e, 0x53, 0x65, 0x6e, 0x73, 0x69,0x74, 0x69,0x76,0x65,0x55,0x52,0x4c} length:16];
NSString *keyone = [[NSString alloc] initWithData:dataOne encoding:NSASCIIStringEncoding];
NSData *dataTwo = [NSData dataWithBytes:(unsigned char []){0x77,0x69,0x74,0x68,0x4f,0x70,0x74,0x69,0x6f,0x6e,0x73} length:11];
NSString *keytwo = [[NSString alloc] initWithData:dataTwo encoding:NSASCIIStringEncoding];
NSString *method = [NSString stringWithFormat:@"%@%@%@%@",keyone,@":",keytwo,@":"];
return method;
}
上面是进入蓝牙界面的方法。也可以有其他的页面可以跳转。设置页面是@"@"Prefs:root=TETHERING",wifi是@"Prefs:root=WIFI"。注意Prefs的P是大写。这么写也有弊端,如果苹果的未公开方法一旦修改。我们必须重新进行修改。
参考我的另外一个回答:https://segmentfault.com/q/10...