[FIXED] openURL: in iOS 10 veraltet

Ausgabe

Apple mit iOS 10 ist veraltet openURL: for openURL:option:completionHandler
Wenn ich:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];

Wie wird es werden? options:<#(nonnull NSDictionary<NSString *,id> *)#>im Detail

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"] options:<#(nonnull NSDictionary<NSString *,id> *)#> completionHandler:nil];

Vielen Dank

Update
options:@{}für leeres Wörterbuch ohne Schlüssel und Wert
http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl/

Lösung

Schreiben Sie so.

Behandeln Sie den VervollständigungsHandler

UIApplication *application = [UIApplication sharedApplication];
NSURL *URL = [NSURL URLWithString:@"http://www.google.com"];
[application openURL:URL options:@{} completionHandler:^(BOOL success) {
    if (success) {
         NSLog(@"Opened url");
    }
}];

Ohne CompletionHandler zu behandeln

[application openURL:URL options:@{} completionHandler:nil];

Schnelles Äquivalent:- open(_:options:completionHandler:)

UIApplication.shared.open(url)


Beantwortet von –
Nirav D


Antwort geprüft von –
David Goodson (FixError Volunteer)

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like