tiktok / tiktok-opensdk-ios

The TikTok OpenSDK features Login Kit and Share Kit which allow your users to log in using their TikTok account and share content from your app to TikTok.
https://developers.tiktok.com
Other
65 stars 20 forks source link

need to install manually or ideally with swift package manager #3

Closed njarecki closed 11 months ago

njarecki commented 1 year ago

we don't use cocoapods. how can we install this? thanks

nickdnk commented 1 year ago

+1 Please support SPM. We have to use CocoaPods only for this SDK, which is stupid.

nickdnk commented 1 year ago

@njarecki Can you rename the issue to "Support Swift Package Manager" or something similar? The issue is formulated as a statement of what you need to do or a question, not a formal request for SPM.

nickdnk commented 1 year ago

@njarecki For now you can use my fork with SPM. Just add this repo: https://github.com/nickdnk/tiktok-opensdk-ios

I've opened a PR for it, but I don't know if it will be released under SPM officially. At least you can get up and running with this, but I won't be maintaining it.

njarecki commented 1 year ago

Thank you Nicolai! You’re a real one! Will try it tomorrow. --NicholasOn Jul 4, 2023, at 3:56 AM, Nicolai Cornelis @.***> wrote: @njarecki For now you can use my fork with SPM. Just add this repo: https://github.com/nickdnk/tiktok-opensdk-ios I've opened a PR for it, but I don't know if it will be released under SPM officially. At least that can get you up and running with this, but I won't be maintaining it.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

njarecki commented 1 year ago

Hey nicolai thanks again so much for the fork!I can’t get share working tho. Maybe you have an idea what I’m doing wrong?We have setup everything on the portal and followed all instructions using the latest sdk.However when we share it just opens tiktok briefly, and then return us to our app. No error message is received.What are we doing wrong? We set up app association file etc. maybe some syntax error there or in plist? But why can’t we see any error messages?Here’s the sharing url we are passing:The sharingUrlIdentifier is: Optional("2FDC078C-7F5B-412B-A7AA-974E55008F3C/L0/001”)Here’s our functions, saving the video in the user’s photo library and then passing that to tiktok.Thanks for your help! nick private func share(app: ShareToApp) {        finishedEditing()        showShareSheet = false        Task{            var image: UIImage?            let urlString = urlString ?? ""            let customImageSource = try? awaitImagePipeline.shared.image(for: urlString)            if let customImage = customImageSource?.image {                image = customImage            } else {                image = ImageRenderer(content: songArtwork).uiImage            }            if let image = image {                songTrackerViewModel.pauseAndSeekToBeginning()                isRendering = true                                let renderer = ImageRenderer(content: CRSongShareImageView(image: image, song: song))                renderer.scale = 3                CRAudioEngine.shared.initiateRenderAudioVideoAndShare(song: song, image: renderer.uiImage) { url,error  in                    guard let url = url else {                        renderFinishedProcessing()                        self.renderingError = error                        return                    }                    mySongsViewModel.sharingUrl = url                    if[.instagram, .tiktok, .iMessage].contains(app) {                        try? PHPhotoLibrary.shared().performChangesAndWait {                            PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)                        }                    }                                        if[.instagram, .tiktok, .iMessage].contains(app) {                        PHPhotoLibrary.shared().performChanges({                            iflet changeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) {                                let placeholder = changeRequest.placeholderForCreatedAsset                                let localIdentifier = placeholder?.localIdentifier                                mySongsViewModel.sharingUrlIdentifier = localIdentifier                            }                        }, completionHandler: { success, error in                            ifsuccess {                                print("Success: (String(describing: mySongsViewModel.sharingUrlIdentifier))")                            } else {                                print("Error: (String(describing: error))")                            }                        })                    }                                                                       renderFinishedProcessing()                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {                        if leterror = mySongsViewModel.shareTo(app: app) {                            self.renderingError = error                        }                    }                }            }        }    }— func shareTo(app:ShareToApp) -> String? {        print("The sharingUrlIdentifier is: (String(describing: sharingUrlIdentifier))")        guard let videoIdentifier = sharingUrlIdentifier else {            print("Error: No video identifier found")            return "No video identifier found"        }        switch app {        case .tiktok:                let shareRequest = TikTokShareRequest(localIdentifiers: [videoIdentifier],                                 mediaType: .video,                                redirectURI: "https://prod.creatormusic.net")                self.activeShareRequest = shareRequest  // Store the request in a property                                shareRequest.send{ [weak self] response in                    guard letshareResponse = response as? TikTokShareResponse else { return}                    ifshareResponse.errorCode == .noError {                        print("Share succeeded!")                    } else {                        print("Share Failed! Error Code: (shareResponse.errorCode.rawValue) Error Message: test) Share State: (shareResponse.shareState)")                    }                                        self?.activeShareRequest = nil  // Clear the reference when you're done with the request                }--NicholasOn Jul 4, 2023, at 2:56 AM, Nicolai Cornelis @.***> wrote: @njarecki For now you can use my fork with SPM. Just add this repo: https://github.com/nickdnk/tiktok-opensdk-ios I've opened a PR for it, but I don't know if it will be released under SPM officially. At least that can get you up and running with this, but I won't be maintaining it.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

nickdnk commented 1 year ago

I would suggest you open a new issue for this. I don't know anything about the share SDK as I don't use it.

stephen-boyle commented 11 months ago

Our latest release (v2.1.0) now supports Swift Package Manager!