using a simple UIActivityViewController
-(void)share{ NSString *textToShare = _mytext; NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; UIImage *imageToShare = _myimage; NSArray *activityItems = @[textToShare, url, imageToShare]; UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; [self presentViewController:activityVC animated:YES completion:nil]; }
I want to share a text, url and image where appropriate.
So if the user chooses mail, everything appears. Etc with the rest of the apps (pinterest, facebook, twitter)
On Facebook Messenger - If a url and an image is shared, the share screen crashes. Is this a known issue (can't send image with a url)?
Open any conversation, then tap the following options at the bottom next to the text box. If you don't see these options, tap next to the text box first. Take and send new photos or videos.
* EDIT: Updated to the latest SDK
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; content.contentTitle = @"Your title"; content.contentDescription = @"Some description text maybe..."; content.contentURL = [NSURL URLWithString:@"http://yourlink.com"]; content.imageURL = [NSURL URLWithString:@"http://yourlink.com/theImage.png"]; [FBSDKMessageDialog showWithContent:content delegate:self]; // Delegate - (void)sharer: (id<FBSDKSharing>)sharer didCompleteWithResults: (NSDictionary *)results { BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue]; NSString *completionGesture = [results valueForKeyPath:@"completionGesture"]; if (completionGesture && [completionGesture isEqualToString:@"cancel"]) { // action was canceled by the user } if (complete) { // the message/link/image was sent } } - (void) sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error { // handle error... }
You can give it a try :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With