Pregunta

I'm using UIActivity class for the first time, with very little modification:

  NSString *textToShare = @"my text";
    UIImage *imageToShare = [UIImage imageNamed:@"myImage.png"];
    NSArray *itemsToShare = @[textToShare, imageToShare];
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
    activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll];
    [self presentViewController:activityVC animated:YES completion:nil];

When I test this, emails, messages, and Facebook are automatically populated with both the textToShare and the imageToShare, while only the image appears on the tweet sheet.

Apple UIActivity class documentation says UIActivityTypePostToTwitter will accept NSString, NSAttributedString, UIImage, AVAsset, and NSURL objects.

The WWDC video examples largely feature Facebook examples, and I've never dealt with Twitter before.

I thought it would populate just like the email/message/Facebook did, and I'm not sure where to go from here. Seems like it should be really simple, but my searches result in much more complex custom-Twitter problems and solutions.

¿Fue útil?

Solución

"my text" was a few characters over the 140 character limit of a tweet. Shortened the text, tweet sheet populates.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top