10

I followed all the steps from documentation and integrated SnapSDK in my iOS app but when I click the share button in my app it directs me to the snapchat but ends up with an error saying

"Something went wrong please try again later".

 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)
                })
            }
        }
    })
}
A O
  • 5,516
  • 3
  • 33
  • 68

1 Answers1

0

Check if your file path url is correct or not this happens when we are not using the correct file path sdk will not be able to find the image.

Kartik Malhotra
  • 239
  • 3
  • 4