问题
Xcode 12.2, swift
console log : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid value found in media: <FBSDKShareVideo: 0x283f91650> - ( "<FBSDKShareVideo: 0x283f91650>"
I want to share Video, URL, Hashtag and text in current logged in user (Facebook App)
,
What I tried so far is,
//I’m downloading file from server.
let data = try Data(contentsOf: outputFile)
var video = ShareVideo(data: data)
if let thumbnail = Functions.videoSnapshot(vidURL: docURL) {
let photo = SharePhoto(image: thumbnail, userGenerated: true)
video = ShareVideo(data: data, previewPhoto: photo)
}
do {
try video.validate(options: ShareBridgeOptions.videoData)
}catch {
print("MARK--> Video validation error: \(error)")
}
let multiMedia = ShareMediaContent()
multiMedia.media = [video] //---->Here it is crashes
multiMedia.contentURL = URL(string: deepLink!)!
multiMedia.hashtag = Hashtag("#HopIndApp")
do {
try multiMedia.validate(options: .videoData)
}catch {
print("MARK--> MultiMedia validation error: \(error)")
}
let dialog = ShareDialog(fromViewController: self, content: multiMedia, delegate: self)
dialog.mode = ShareDialog.Mode.automatic
dialog.shouldFailOnDataError = true
do {
try dialog.validate()
dialog.show()
return
}
catch {
print(error)
}
I have also tried to make ShareVideo(url)
but this requires PHAsset url, not the downloaded file url.
SO, I'm stuck here
Please help me on this.. Thanks in advance
来源:https://stackoverflow.com/questions/65155294/invalid-value-found-in-media-fbsdksharevideo