我在容器视图中使用 UIActivityViewController。我想通过电子邮件、推特和脸书分享一些文字。虽然最后两个工作完美,但电子邮件有问题。问题是作曲家视图不会通过取消事件或尝试发送它来消除!当 ActivityView 出现时,我收到以下消息:
Launch Services: Registering unknown app identifier com.apple.mobilemail failed
Launch Services: Unable to find app identifier com.apple.mobilemail
这很奇怪,因为应用程序标识符确实没有问题,并且我可以在其他视图控制器中使用 ActivityViewController 与电子邮件共享文本(当不在容器视图中时)。我的代码,如下:
- (void)openBtnTouched {
NSString *alertTitleString = [[[GlobalVariables sharedInstance].alertsArray objectAtIndex:self.selectedIndex]objectForKey:@"alertTitle"];
NSString *alertMsgString = [[[GlobalVariables sharedInstance].alertsArray objectAtIndex:self.selectedIndex]objectForKey:@"alertMessage"];
UIActivityViewController *activity;
activity = [[UIActivityViewController alloc] initWithActivityItems:@[alertTitleString,alertMsgString] applicationActivities:nil];
activity.excludedActivityTypes = @[
UIActivityTypeMessage,
UIActivityTypePostToWeibo,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAssignToContact,UIActivityTypeCopyToPasteboard];
activity.completionHandler = ^(NSString *activityType, BOOL completed){
NSLog(@"Activity Type selected: %@", activityType);
if (completed) {
NSLog(@"Selected activity was performed.");
} else {
if (activityType == NULL) {
NSLog(@"User dismissed the view controller without making a selection.");
} else {
NSLog(@"Activity was not performed.");
}
}
};
[self presentViewController:activity animated:YES completion:NULL];
}