Invalid value found in media: <FBSDKShareVideo>

本小妞迷上赌 提交于 2021-01-29 08:07:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!