Error calling startSnapping
raphaelrk opened this issue · 2 comments
Getting the following error from startSnapping:
Optional(Error Domain=SCSDKCreativeKitErrorDomain Code=1 "error_description_invalid_argument" UserInfo={NSLocalizedRecoverySuggestion=Please check documentation for potential mistakes. Please content snapkit-support@snap.com if problem persists., NSLocalizedDescription=error_description_invalid_argument, NSLocalizedFailureReason=})
I can't find any results for what "SCSDKCreativeKitErrorDomain Code=1" could mean and thought I should ask here.
What I'm passing in, roughly:
A SCSDKVideoSnapContent("...") // pass in a file:// URL pointing to a video saved to my app's cache directory
- sticker: nil
- attachmentUrl: nil
Snap also isn't opening when I run the following code, maybe of some significance. The error doesn't print either.
let snap: SCSDKSnapContent = SCSDKNoSnapContent()
snap.caption = "Woah"
snap.attachmentUrl = "https://www.facebook.com/"
let snapAPI = SCSDKSnapAPI()
snapAPI.startSending(snap) {(error: Error?) in
print("error \(error!)")
}
Update: fixed this^ issue by making snapAPI a class variable, via #5 (comment), but still running into the original error.
Not totally sure how but I got things working.
My updated code:
fileprivate lazy var snapAPI = {
return SCSDKSnapAPI()
}()
@objc
func shareToSnapchat() -> Void {
let url = URL(string: "...") // remote video URL on s3
let video = SCSDKSnapVideo(videoUrl: url!)
let snap = SCSDKVideoSnapContent(snapVideo: video)
snap.caption = "Testing"
snapAPI.startSending(snap) {(error: Error?) in
print("Oh noo \(String(describing: error))")
}
}
Some of the things I changed in the process that may have helped:
- In my app's "version" in the snapkit dashboard, I had to change the description before I could set it as my staging version. Before it was saying "Failed to save app due to an unknown error"
- My bundle ID was set for iOS production. I switched it to iOS staging.
- I made snapAPI a class variable
- I rewrote the code that called the snapAPI from a tangled mess to roughly the above