Was wandering if anyone can offer some insight. For the life of me I can't figure out how to send a UIImage with UIActivityTypeMessage all though some say it is possible.
The docs say: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIActivity_Class/Reference/Reference.html
UIActivityTypeMessage
The object posts the provided content to the Messages app. When using this service, you can provide NSString and NSAttributedString objects as data for the activity items. You may also specify NSURL objects whose contents use the sms scheme. Available in iOS 6.0 and later. Declared in UIActivity.h.
So to my understanding I can only send NSString/NSURL. I don't see you it is possible.
I'm using this:
UIImage *image; // some image here.
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[ image ] applicationActivities:nil];
Any help would be much appreciated.
While it seems possible to get the message app to appear in the share sheet using UIActivityViewController in iOS6, there is some secret to get it to work--iOS7 is a different story, passing the NSURL to the asset works out of the box.
Not sure you are getting your images from the ALAssetsLibrary, but if so, grab the ALAsset using its NSURL rather than pulling the UIImage. The share sheet appears in a fraction of the time. This isn't exactly the code I'm using, but similar. But on iOS6, the activity view controller will not show the messages app so long as there is an image attached.
- (void) presentActivityViewController:(ALAsset*) asset {
// add this to your viewController class
NSDictionary *urls = [asset valueForProperty:ALAssetPropertyURLs];
NSURL *url;
if ([urls count]) {
for (NSString *key in urls) {
// I'm making an assumption that the URL I want is the first URL in the dictionary
url = [urls objectForKey:key];
break;
}
}
NSArray *activityItems = @[url];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
}