问题
We have recently released iPhone app which share to fb & tw using UIActivityViewController like as zigzag app on app store.
My device is working perfect as my device is used for development. But all users who downloaded this app not able to share using this function.
NSString *txtToShare = @"Please try this awesome iOS app";
NSArray *objectsToShare = [NSArray arrayWithObjects:txtToShare, nil];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:^{
}];
if ([activityVC respondsToSelector:@selector(popoverPresentationController)])
{
// iOS 8+
UIPopoverPresentationController *presentationController = [activityVC popoverPresentationController];
presentationController.sourceView = sender; // if button or change to self.view.
}
Can anybody tell me why?
回答1:
I had same issue and I resolved this using following technique Declared two constants
static NSString *const twitterAppBundleStringForOS8 = @"com.atebits.Tweetie2.ShareExtension";
static NSString *const facebookAppBundleStringForOS8 = @"com.facebook.Facebook.ShareExtension";
if ([self.activityType isEqualToString:UIActivityTypePostToFacebook] || [self.activityType isEqualToString:facebookAppBundleStringForOS8]) {
text = @"abc";
}
else if( [self.activityType isEqualToString:UIActivityTypePostToTwitter] || [self.activityType isEqualToString:twitterAppBundleStringForOS8]){
text = @"cc";
}
It is working fine now
When I had issue I had following code
if ([self.activityType isEqualToString:UIActivityTypePostToFacebook] ) {
text = @"abc";
}
else if( [self.activityType isEqualToString:UIActivityTypePostToTwitter] ){
text = @"cc";
}
I hope it helps, if not then let me know.
来源:https://stackoverflow.com/questions/29816402/uiactivityviewcontroller-facebook-and-twitter-share-not-working-in-released-ios