本文介绍了UIActivityViewController通过文件URL共享时认为我的jpg是视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在Documents目录中保存了jpg文件,可以从标准UIActivityViewController共享它们.所有活动项(包括保存图像")均按预期工作,但是,当jpg实际上已保存到相机胶卷中时,轻按保存图像"时,控制台中仍显示以下错误.I have jpg files saved in the Documents directory that can be shared from a standard UIActivityViewController. All activity items (including Save Image) work as expected, but when Save Image is tapped, the following error shows in the console, despite the fact that the jpg does actually get saved to the camera roll.这是iOS中的错误,还是我必须以某种方式在文件URL中指定我的文件是jpg(而不是视频)?Is this a bug in iOS, or do I have to somehow specify that my file is a jpg (and not a video) in the file URL?这是我正在使用的代码:Here's the code I'm using:NSURL *fileURL = [NSURL fileURLWithPath: [...path to my file...] isDirectory:NO];UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[fileURL] applicationActivities:nil];activityViewController.excludedActivityTypes = @[UIActivityTypeCopyToPasteboard, UIActivityTypePrint, UIActivityTypeAssignToContact, UIActivityTypeAddToReadingList, UIActivityTypePostToVimeo];[self presentViewController:activityViewController animated:YES completion:nil];推荐答案在尝试保存png文件时收到了以上消息.还注意到其他一些错误消息.在跟踪这些问题时,通过将OS_ACTIVITY_MODE与disable一起使用来解决了这两个问题,如以下问题/答案所示:从公共有效用户设置中读取"在iOS 10中I got the above message when trying to save a png file. Also noticed some other error messages. In tracking those down, got rid of both problems by applying the OS_ACTIVITY_MODE with disable as seen in following question/answer: "Reading from public effective user settings" in iOS 10 这篇关于UIActivityViewController通过文件URL共享时认为我的jpg是视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!