Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update ShareKit example code for fix #31 #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,19 @@ import TikTokOpenShareSDK

let shareRequest = TikTokShareRequest(localIdentifiers: [...], mediaType: .video, redirectURI: "https://www.example.com/path")
shareRequest.send { response in
let shareResponse = response as? TikTokShareResponse else { return }
if shareResponse.errorCode == .noError {
print("Share succeeded!")
if let shareResponse = response as? TikTokShareResponse {
if shareResponse.errorCode == .noError {
print("Share succeeded!")
} else {
print("Share Failed!")
print("Error Code: \(shareResponse.errorCode.rawValue)")
print("Error Message: \(shareResponse.errorDescription ?? "")")
print("Share State: \(shareResponse.shareState)")
}
} else {
print("Share Failed!
Error Code: \(shareResponse.errorCode.rawValue)
Error Message: \(shareResponse.errorMessage ?? "")
Share State: \(shareResponse.shareState)")
// Handle error when response is not a TikTokShareResponse
}

}
```
Your app is responsible for maintaining a strong reference to the request in order to receive the response callback. You can discard it when you are done with the response.
Expand Down