ios - UIActivityViewController:短信选项未显示

时间:2013-10-01 13:13:39

标签: ios sms uiactivityviewcontroller

我正在使用UIActivityViewController来允许通过Mail,Facebook,Twitter和SMS进行共享。我有以下代码:

-(void) aFunction
{
NSString *textToShare = appRecord.title;
UIImage *imageToShare = [UIImage imageNamed:@"test/png"];
NSURL *url = [NSURL URLWithString:@"http://www.stackoverflow.com"];
NSArray *activityItems = [[NSArray alloc]  initWithObjects:textToShare, imageToShare,url,nil];


UIActivity *activity = [[UIActivity alloc] init];

NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
                                  applicationActivities:applicationActivities];

activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact, UIActivityTypePrint ,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll,UIActivityTypeMessage ];

[self presentViewController:activityVC animated:YES completion:nil];
[activityItems release];
[activity release];
[applicationActivities release];
[activity release];
}

代码产生以下内容:

http://s24.postimg.org/tas3zo9w5/Screen_Shot_2013_10_01_at_5_09_26_PM.png

缺少短信选项。我做错了什么?

1 个答案:

答案 0 :(得分:3)

您要排除UIActivityTypeMessage(excludedActivityTypes)。这会隐藏消息(SMS / iMessage)选项