Reputation: 975
I am using a UIActivityViewController to share info from my app to Twitter and FB, which are properly configured in Settings. The code is the simplest possible:
- (IBAction)share {
NSString *postText = @"some text";
UIImage *postImage = [UIImage imageNamed:@"myImage"];
NSURL *postURL = [NSURL URLWithString:@"myUrl"];
NSArray *activityItems = @[postText, postImage, postURL];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityController.excludedActivityTypes =
@[
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeCopyToPasteboard,
UIActivityTypeMail,
UIActivityTypeMessage,
UIActivityTypePostToWeibo,
];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
if ([activityType isEqualToString:UIActivityTypePostToFacebook]) {
if (completed) [self doSomethingForFB];
} else if ([activityType isEqualToString:UIActivityTypePostToTwitter]) {
if (completed) [self doSomethingForTwitter];
}
}];
[self presentViewController:activityController animated:YES completion:nil];
}
This code works like a charm on the simulator (both iphone and ipad, both ios7 and ios6), but on my device (an iPad with iOS7), when the ActivityViewController shows up, Twitter and FB are there, because the labels are visible, but their icons are missing.
In this answer to a similar question it is claimed that the problem is that the app is an iphone app and the device is an ipad (I can't check this, because my iPhone has iOS 6, which works perfectly). However:
Upvotes: 9
Views: 3282
Reputation: 113
On iPad you must present the UIActivityViewController in a popover. For iPhone and iPod you must present it modally. UIActivityViewController displays social networks(Facebook & Twitter) icons if you have successfully logged in.
Upvotes: 1
Reputation: 1
I can't actually provide you an answer, but if you can't solve the issue, I can suggest to read how to force the icons customization.
- Topic on stackoverflow: example-of-how-to-customize-uiactivityviewcontroller-share-menu
- Good post: objective-c-custom-uiactivityviewcontroller-icons-text
Hope this helps a little.
Upvotes: 0