2016-11-10 3 views
0

Ich muss das Bluetooth-Einstellungsmenü in IOS10 und höher öffnen. [[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "prefs: root = Bluetooth"]]; funktioniert nicht in ios 10.Öffnen Sie das Bluetooth-Einstellungsmenü in IOS 10

Nach der Erkundung mehrere Dokument habe ich unter Link, die Code zur Verfügung stellen, die ordnungsgemäß funktioniert. https://gist.github.com/johnny77221/bcaa5384a242b64bfd0b8a715f48e69f

Aber jetzt habe ich Frage wird App Store diesen Patch-Code akzeptieren oder sie werden Anwendung ablehnen.

Bitte helfen Sie mir, dieses Problem zu lösen.

Vielen Dank im Voraus

+1

es nicht mehr in iOS funktioniert 10. –

+1

vielleicht einen Blick auf diese und sehen, ob es http://useyourloaf.com/blog/openurl-deprecated-in-ios10/ – yawnobleix

+0

hilft Can u bitte Überprüfen Sie "https://gist.github.com/johnny77221/bcaa5384a242b64bfd0b8a715f48e69f" diesen Link und sagen Sie mir mit diesem Code wird app Store erlauben, Anwendung zu laden, oder sie werden die Anwendung ablehnen. – Priyanka

Antwort

2

Swift 3.0: - Arbeiten in allen iOS-Version bis zu iOS 10.2

let url = URL (string: "App-Prefs: root") // für Systemeinstellung App

@IBAction func blutootheButtonTapped(_ sender: AnyObject) { 
let url = URL(string: "App-Prefs:root=Bluetooth") //for bluetooth setting 
    let app = UIApplication.shared 
    app.openURL(url!) 
} 
0

Ab iOS 10 sollte "App-Prefs: root" anstelle von "prefs: root" verwendet werden. Siehe unter Objective C-Code. Getestet, Code funktioniert gut, aber Apple kann die App aus diesem Grund ablehnen.

NSString *settingsUrl= @"App-Prefs:root=Bluetooth"; 
if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) { 

     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:settingsUrl] options:@{} completionHandler:^(BOOL success) { 
     NSLog(@"URL opened"); 
     }]; 
}