我正在使用的代码(在iOS 7中完美运行):
UIActivityVIEwController *activityVC = [[UIActivityVIEwController alloc]initWithActivityItems:@[[Nsstring stringWithFormat:@"Sent from http://appstore.com/appname"],[UIImage imagenamed:@"SomeImage"]]applicationActivitIEs:nil];activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact,UIActivityTypePrint,UIActivityTypecopytopasteboard,UIActivityTypeSavetoCameraRoll,UIActivityTypeAddToReadingList,UIActivityTypePostToVimeo,UIActivityTypeAirDrop];[self presentVIEwController:activityVC animated:YES completion:NulL];
我试图弄清楚为什么会发生这种情况,以及如何解决它.我很感激任何帮助.附上了问题/错误的截图:
解决方法 这是视频文件共享的解决方法.也许你可以尝试相同的图像.我有视频数据,我首先保存到文档目录中的文件,然后我附加了该文件.
//write to a file [vIDeoData writetofile:[NSHomeDirectory() stringByAppendingPathComponent:@"documents/image.mov"] atomically:YES];(IBAction)ShareVIDeoWihFacebook:(ID)sender {//get the file url Nsstring* path =[NSHomeDirectory()stringByAppendingPathComponent:@"documents/image.mov"];NSURL *vIDeoURL = [NSURL fileURLWithPath:path];UIActivityVIEwController * activityVC = [[UIActivityVIEwController alloc] initWithActivityItems:@[vIDeoURL,@"Created by ..."] applicationActivitIEs:NulL];[activityVC setExcludedActivityTypes:@[ UIActivityTypeMail,UIActivityTypeAssignToContact,UIActivityTypePostToWeibo,UIActivityTypeMessage,UIActivityTypeAirDrop,UIActivityTypeSavetoCameraRoll]];[activityVC setValue:@"My VIDeo" forKey:@"subject"];[activityVC setCompletionHandler:^(Nsstring *activityType,BOol completed) {//NSLog(@"completed dialog - activity: %@ - finished flag: %d",activityType,completed);}];[self presentVIEwController:activityVC animated:TRUE completion:nil];}总结
以上是内存溢出为你收集整理的在iOS 8中,使用UIActivityViewController共享图像是空白/损坏的全部内容,希望文章能够帮你解决在iOS 8中,使用UIActivityViewController共享图像是空白/损坏的所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)