truecaller / ios-sdk

Apache License 2.0
16 stars 17 forks source link

redirect to the app issue #68

Open vanijain3108 opened 4 months ago

vanijain3108 commented 4 months ago

I am using truesdk latest version when I request for truecaller profile the true caller app open but after click on continue to share truecaller profile with my app it stuck on the same page not going back to the app and not did receive or did fail any of these function is not called

please help to solve the redirect to the app with response or error issue

// // ViewController.swift // truecallerCheck // // Created by Fast Media on 30/07/24. //

import UIKit import TrueSDK

class ViewController: UIViewController, TCTrueSDKDelegate { override func viewDidLoad() { super.viewDidLoad() TCTrueSDK.sharedManager().delegate = self print("ViewController loaded and TrueSDK delegate set") // Do any additional setup after loading the view. } @IBAction func buttonAction(_ sender: UIButton) { TCTrueSDK.sharedManager().requestTrueProfile()

}
func didReceive(_ profile: TCTrueProfile) {
    print("User verified with Truecaller: \(profile.firstName) \(profile.lastName), phone number: \(profile.phoneNumber)")
}

func didFailToReceiveTrueProfileWithError(_ error: TCError) {
    print("Failed to receive Truecaller profile with error: \(error.localizedDescription)")

}
func verificationStatusChanged(to verificationState: TCVerificationState) {
        switch verificationState {
        case .verificationComplete:
            print("Verification successful.")
        case .otpInitiated:
            print("OTP initiated")
        case .otpReceived:
            print("OTP received")
        case .verifiedBefore:
            print("Verified before")
        @unknown default:
            print("Unknown state")
        }
    }

}

and in the app delegate I use this

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Setup Truecaller SDK let appKey = "0000000000000000000000000000000000000" let appLink = "https://si00000000000000000000000000000000.truecallerdevs.com/" TCTrueSDK.sharedManager().setup(withAppKey: appKey, appLink: appLink) print("Truecaller SDK setup complete") return true }