2017-06-02 4 views
0

Ich habe eine RMS Protected PDF-Datei so etwas wie 'sample.ppdf'. Es wird von einer URL geladen. Wenn ich folgendes implementiere: UIApplication.SharedApplication.OpenUrl (new NSUrl (_documentUrl));SKSafariViewController Nicht öffnen Geschützte PDF in iOS

iPhone Safari App öffnet und fragt mich nach einer Option mit einem bestimmten App 'AIP-Viewer'

Nun zu öffnen, wenn ich versuche, das gleiche mit dem folgenden Code Implementierung:

SFSafariViewController *svc = [[SFSafariViewController alloc] initWithURL:url]; 
svc.delegate = self; 
[self presentViewController:svc animated:YES completion:nil]; 

SKSafariViewController öffnet aber ist leer.

Antwort

0
/*! @abstract Returns a view controller that loads a URL. 
    @param URL the initial URL to navigate to. Only supports initial URLs with http:// or https:// schemes. 
*/ 
- (instancetype)initWithURL:(NSURL *)URL; 

Stellen Sie sicher, URL http: // * oder https: // *

0

SFSafariViewController mit Version iOS 9.0+ kompatibel ist. Stellen Sie die Versionsüberprüfung, wenn die iOS version kleiner als iOS 9.0 ist, öffnen Sie sie direkt im Safari-Browser.

Try this,

NSURL *urlAsString = [NSURL URLWithString:[NSString stringWithFormat:@"Your_URL"]]; 

if ([SFSafariViewController class] != nil) { 

    SFSafariViewController *sfvc = [[SFSafariViewController alloc] initWithURL:urlAsString]; 

    [self presentViewController:sfvc animated:YES completion:nil]; 

} 
else { 
    [[UIApplication sharedApplication] openURL:urlAsString]; 

}