- (voID)shareAVIDeoWithSubject:(Nsstring*)subject link:(Nsstring *)string onVIEwController:(UIVIEwController *)vIEwController fromVIEw:(UIVIEw *)vIEw { _activityVIEwController = [[UIActivityVIEwController alloc] initWithActivityItems:@[string] applicationActivitIEs:nil]; _activityVIEwController.excludedActivityTypes = @[UIActivityTypePrint,UIActivityTypeAssignToContact,UIActivityTypeSavetoCameraRoll,UIActivityTypeAddToReadingList,UIActivityTypeAirDrop]; [_activityVIEwController setValue:subject forKey:@"subject"]; UIWindow *window = [[[UIApplication sharedApplication] delegate]window]; //if iPhone if (UI_USER_INTERFACE_IdioM() == UIUserInterfaceIdiomPhone) { if(!vIEwController){ vIEwController = ((SWRevealVIEwController*)window.rootVIEwController).presentedVIEwController; } [vIEwController presentVIEwController:_activityVIEwController animated:YES completion:nil]; } //if iPad else { // Change Rect to position Popover popup = [[UIPopoverController alloc] initWithContentVIEwController:_activityVIEwController]; UIbarbuttonItem *barbutton = [[UIbarbuttonItem alloc] initWithCustomVIEw:vIEw]; [popup presentPopoverFrombarbuttonItem:barbutton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; }}
我在StackOverFlow上查看了以下两个问题。
> UIActivityViewController not showing body text in gmail
> UIActivityViewController not showing body text in gmail
这些不是我的问题的答案,因为他们在列表中添加了新的活动,而我希望iOS显示所有可共享的应用程序。在这种情况下,Gmail共享正在变空。
提前致谢。
添加截图,
设置正文和主题的正确方法(iOS 7.0及更高版本) – 在要共享的项目上实现UIActivityItemSource协议。
// EmailitemProvIDer.h@interface EmailitemProvIDer : NSObject <UIActivityItemSource>@property (nonatomic,strong) Nsstring *subject;@property (nonatomic,strong) Nsstring *body;@end// EmailitemProvIDer.m#import "EmailitemProvIDer.h"@implementation EmailitemProvIDer- (ID)activityVIEwControllerPlaceholderItem:(UIActivityVIEwController *)activityVIEwController { return _body;}- (ID)activityVIEwController:(UIActivityVIEwController *)activityVIEwController itemForActivityType:(Nsstring *)activityType { return _body;}- (Nsstring *)activityVIEwController:(UIActivityVIEwController *)activityVIEwController subjectForActivityType:(Nsstring *)activityType { return _subject;}@end
而不是呈现它:
EmailitemProvIDer *emailitem = [EmailitemProvIDer new];emailitem.subject = @"Subject";emailitem.body = @"Body";UIActivityVIEwController *activityVIEwController =[[UIActivityVIEwController alloc] initWithActivityItems:@[emailitem] applicationActivitIEs:nil];[self presentVIEwController:activityVIEwController animated:YES completion:nil];
这将在邮件应用程序上设置正文和主题,但似乎Gmail应用程序忽略主题并将其设置为正文。
重要提示:似乎Gmail应用中存在错误。传递与传播字符使消息主题和正文是空的。使用& amp;代替。其他特殊字符未经过测试。
总结以上是内存溢出为你收集整理的ios – UIActivityViewController Gmail分享主题和正文是否空白?全部内容,希望文章能够帮你解决ios – UIActivityViewController Gmail分享主题和正文是否空白?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)