1

我正在使用UIActivityViewController允许通过邮件、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

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

4

1 回答 1

3

您正在排除 UIActivityTypeMessage (excludedActivityTypes)。这隐藏了消息 (SMS/iMessage) 选项

于 2013-10-01T13:21:33.617 回答