我的iOS是8.1.2,我正在使用UIActivityViewController进行社交共享。我单击一个按钮,并允许UIActivityViewController呈现
- (IBAction)UIActivityTypeButtonClick:(id)sender {
NSString* text=@"I am sharing this text";
NSArray* sharedArray=@[text];
UIActivityViewController * activityVC=[[UIActivityViewController alloc]initWithActivityItems:sharedArray applicationActivities:nil];
activityVC.excludedActivityTypes=@[];
[self presentViewController:activityVC animated:YES completion:nil];
}
我得到这个
我收到Message,Twitter,Mail,WhatsApp和一个More按钮。
点击更多我得到这个。
FACEBOOK在哪里?我的iPhone中有facebook应用程序,并且在设置中也设置了我的ID。但是facebook从来没有出现在这里。Twitter的。这是错误还是什么?请建议
谢谢
I first saw this when Facebook updated their app on April 24th. Plain text sharing to Facebook isn't working as long as the Facebook app is installed. After you delete it, it's available again.
If you try to share a URL or an image together with the plain text, you will see Facebook as an option but the text field will be blank. The image or URL will attach without a problem.
I posted a sample project that reproduces this problem on github:
https://github.com/djr/UIActivityViewController-Facebook
This is not an answer, but it's pretty clear that the problem is caused by the Facebook app.
EDIT:
It's not ideal, but I created a workaround. Don't forget that you will need to attach an image or a URL for this to work.
Detect if the user has the Facebook app installed. If they do, then give them some type of informational message.
BOOL facebookIsInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]];
BOOL isUserLoggedInWithFacebook = [SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook];
if(isUserLoggedInWithFacebook && facebookIsInstalled)
{
// Explain that they have to copy and paste in order to share on Facebook
}
创建UIActivityItemProvider的子类并覆盖
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType
{
NSString *stringToShare = @"string to share";
if([activityType isEqualToString:UIActivityTypePostToFacebook] ||
[activityType isEqualToString:@"com.facebook.Facebook.ShareExtension"] ||
[activityType.lowercaseString rangeOfString:@"facebook"].length)
// Because who knows when they are going to change the activityType string?
{
// Automatically copy the text for them
[[UIPasteboard generalPasteboard] setString:stringToShare];
}
return stringToShare;
}
告诉用户他们必须粘贴到Facebook文本字段中才能共享。
责怪它在Facebook上。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句