2016-07-29 3 views
0

Ich versuche, eine URL zu teilen, sodass die URL in Safari oder einem beliebigen Webbrowser geöffnet werden sollte, dies aber nicht möglich ist. Ich habe das zu meinem MAC und MAC geschickt, es als Textdatei öffnend, und indem ich darauf klicke, gehe ich zur Safari, aber im Falle von iPhone kämpfe ich, um es zu öffnen. Im Falle von NSURL stürzt meine APP mit einer Ausnahme ab. Hier ist mein CodeGemeinsame Nutzung einer URL über Bluetooth (UIActivityViewController) nicht möglich

NSString *[email protected]"www.google.com"; 
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[url] applicationActivities:nil]; 

// Exclude all activities except AirDrop. 
NSArray *excludedActivities = @[UIActivityTypePostToTwitter, UIActivityTypePostToFacebook, 
           UIActivityTypePostToWeibo, 
           UIActivityTypeMessage, UIActivityTypeMail, 
           UIActivityTypePrint, UIActivityTypeCopyToPasteboard, 
           UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, 
           UIActivityTypeAddToReadingList, UIActivityTypePostToFlickr, 
           UIActivityTypePostToVimeo, UIActivityTypePostToTencentWeibo]; 
controller.excludedActivityTypes = excludedActivities; 

// Present the controller 
[self presentViewController:controller animated:YES completion:nil]; 

Antwort

1

Ändern Sie diese Zeile:

NSString *[email protected]"www.google.com"; 

zu:

NSURL *url= [NSURL URLWithString:@"https://www.google.com"]; 

Wenn dies nicht für Sie funktioniert auf Grund eines Sturzes ist es wahrscheinlich ein Problem an anderer Stelle, aber mache den Absturzbericht verfügbar und vielleicht kann ich helfen.

Verwandte Themen