我遵循了文档中的所有步骤,并将SnapKit
集成到了iOS应用程序中,但是当我单击应用程序中的“共享”按钮时,它会将我定向到snapchat
,但最终出现错误提示>
“出了点问题,请稍后再试”。
private func didTapSnapchatShare(cell: FeedTableViewCell){
print("Share button tapped ")
cell.pauseVideoAndAnimation()
showProgressIndicator(view: self.view)
var watermarkStr = ""
if let userName = cell.cellDataSource?.user?.name {
watermarkStr = userName
}
let promptImage = cell.promptView?.asImage()
cell.slPlayer?.exportVideo(withWatermarkString: watermarkStr, promptImage: promptImage, completionHandler: { status, filePathURL in
DispatchQueue.main.async {
hideProgressIndicator(view: self.view)
if status, let filePathURL = filePathURL {
let url = URL(string: "snapchat://")!
if(!UIApplication.shared.canOpenURL(url)){
if let reviewURL = URL(string: "https://itunes.apple.com/us/app/snapchat/id447188370?mt=8"), UIApplication.shared.canOpenURL(reviewURL) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(reviewURL, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(reviewURL)
}
return
}
}
let video = SCSDKSnapVideo(videoUrl:filePathURL)
let videoContent = SCSDKVideoSnapContent.init(snapVideo: video)
let api = SCSDKSnapAPI(content: videoContent)
api.startSnapping(completionHandler: { (error: Error?) in
print(error?.localizedDescription)
})
}
}
})
}