0

I have an application which collects the video assets of a users camera roll, using the Photos Framework and methods requestImage & requestAVAsset

I'm allowing the user to share the asset using the UIActivityViewController class and the URL from the AVAsset. My problem is that for some strange reason it won't allow me to share the video.

On the app the error message I get on the UIActivityViewController is

The item cannot be shared. Please select a different item.

Any pointers or advise is appreciated, thanks!

Here is how I present the UIActivityViewController:

let selectedVideo = self.selectedVideo //(AVAsset)
let videoURLPath = selectedVideo.url // URL

DispatchQueue.main.async {
    let activityItems: [Any] = [videoURLPath]
    let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)

    activityViewController.excludedActivityTypes = [UIActivity.ActivityType.addToReadingList, UIActivity.ActivityType.airDrop, UIActivity.ActivityType.assignToContact,]

    activityViewController.popoverPresentationController?.sourceView = self.view
    activityViewController.popoverPresentationController?.sourceRect = self.view.frame

    self.present(activityViewController, animated: true, completion: nil)
}

Here's how the video URL looks:

file:///var/mobile/Media/DCIM/107APPLE/IMG_7966.MP4

Fuad Adetoro
  • 137
  • 1
  • 9
  • Show the code for how are you presenting `UIActivityViewController`. Also please let us know on which social network you're trying to share the video and video is a normal video or it is recorded as slow motion video? – TheTiger Jan 15 '19 at 12:28
  • please share your code. another problem is if you have linked your iTunes account for storage optimization in your phone then you can't share videos as they need to download from iCloud first. – Gagan_iOS Jan 15 '19 at 12:31
  • @TheTiger I've now added in the code, the video's I target are boomerang videos and mostly have a duration of 3.55, no slow motion. – Fuad Adetoro Jan 15 '19 at 12:34
  • @Gagan_iOS I've just shared my code. Also my videos aren't on iCloud they're on my device but that's a great point. – Fuad Adetoro Jan 15 '19 at 12:35
  • @TheTiger I'm attempting to share to Whatsapp. – Fuad Adetoro Jan 15 '19 at 12:36
  • @FuadAdetoro Have you checked the size of that video? It should not be exceed than what whatsapp allows. – TheTiger Jan 15 '19 at 12:37
  • @TheTiger I can't imagine that it exceeds what whatsapp allows as the video is only for 3.55 seconds. – Fuad Adetoro Jan 15 '19 at 12:39
  • @FuadAdetoro Oh I read it like 3:55 I was not expecting the time with a dot. Anyway checking on your issue. – TheTiger Jan 15 '19 at 12:40
  • @FuadAdetoro Did you try sharing on any other social network? It might be a issue with whats app too. Also please share the code how are you getting `AVAsset`, share the log of `asset.url`. – TheTiger Jan 15 '19 at 12:42
  • Please have a look in these URLs 1. https://stackoverflow.com/questions/36603921/this-item-cannot-be-shared-please-select-a-different-item-whatsapp-ios-share . 2. https://stackoverflow.com/questions/39423821/whatsapp-showing-alert-this-item-cannot-be-shared-please-select-a-different-it . 3. https://stackoverflow.com/questions/36713717/this-item-cannot-be-shared-please-select-a-different-item-sharing-a-simple-te . Might be issue with whatsapp https://github.com/jberlana/JBWhatsAppActivity – Gagan_iOS Jan 15 '19 at 12:59
  • Thanks for your help guys, I've managed to fix this issue now! – Fuad Adetoro Jan 15 '19 at 16:08
  • @FuadAdetoro What was the issue? – TheTiger Jan 16 '19 at 06:02

0 Answers0