Truecaller for Developers
  • Hello!
  • Why Truecaller SDK?
  • Getting Started
  • Android
    • OAuth SDK 3.1.0
      • Implementing user flow for your App
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Integration Steps
        • Generating Client ID
        • Setup
        • Implementing Callbacks
        • Initialisation
        • Setting up OAuth parameters
        • Invocation
        • Customisation
        • Clearing SDK Instance
        • Handling Error Scenarios
        • Integrating with your Backend
          • Fetching User Token
          • Fetching User Profile
        • Non Truecaller User Verification
          • Completing Verification
          • TrueException
          • Server Side Validation
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Non-Truecaller user verification flow
          • Truecaller user verification flow
          • Test Setup
        • Google play store app permission declaration form
        • Moving to Production
    • OAuth SDK 3.0.0
      • Implementing user flow for your App
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Integration Steps
        • Generating Client ID
        • Setup
        • Implementing Callbacks
        • Initialisation
        • Setting up OAuth parameters
        • Invocation
        • Customisation
        • Clearing SDK Instance
        • Handling Error Scenarios
        • Integrating with your Backend
          • Fetching User Token
          • Fetching User Profile
        • Non Truecaller User Verification
          • Completing Verification
          • TrueException
          • Server Side Validation
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Non-Truecaller user verification flow
          • Truecaller user verification flow
          • Test Setup
        • Google play store app permission declaration form
        • Moving to Production
    • SDK v2.8.0[Deprecating Soon ⚠️]
      • Implementing user flow for your app
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Generating App Key
      • Integrating with your App
        • Setup
        • App Key Configuration
        • Initialisation
        • Customisation
        • Implement Callbacks
        • Clearing SDK instance
        • Handling Error Scenarios
        • Verifying non Truecaller users
          • TrueException
          • Completing Verification
        • Advanced Steps
      • Server Side Response Validation
        • For Truecaller users verification flow
        • For Non-Truecaller users verification flow
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Truecaller user verification flow
          • Non-Truecaller User Verification Flow
          • Test Setup
        • Google Play App Signing
        • Google Play Store app permissions declaration
        • Google Play Policy Change for Device Identifiers
      • Changelog
    • Change Log
  • Mobile Websites
    • Implementing user flow for your Mobile Website
    • Generating App Key
    • Integrating with your mobile website
      • Initialisation
      • Invoking verification
      • Fetch User Profile
      • Completing User Verification
      • Handling Error Scenarios
    • Getting Release Ready
      • Instrumentation
      • Testing your verification flow
  • iOS
    • Generating App Key
    • Integrating with your iOS App
      • Setup
      • Configuration
      • Usage
        • Swift
        • Objective-C
      • Verifying Non-Truecaller app users
        • Completing Verification
      • Handling Error Scenarios
        • Safari Redirection
    • Server Side Response Validation
  • Shopify App
    • Generating App Key
    • App Configuration
    • Deactivating App Block
  • FAQS
    • General
    • Developer Account
    • Android App SDK
    • Android OAuth SDK
    • Mobile Web SDK
    • Number Verification Plugin
  • Product Updates
    • App Review Process
    • Introducing dark theme
Powered by GitBook
On this page
Export as PDF
  1. iOS
  2. Integrating with your iOS App

Verifying Non-Truecaller app users

This section defines the steps that can be used to trigger verification of non Truecaller app users which will be powered via Truecaller's SMS based OTP ( Currently available only for India )

On the Mobile number entry screen set the below delegates :

Swift:

TCTrueSDK.sharedManager().delegate = self TCTrueSDK.sharedManager().viewDelegate = self

Objective C:

[TCTrueSDK sharedManager].delegate = self; [TCTrueSDK sharedManager].viewDelegate = self;

viewDelegate needs to be set on the mobile number entry screen i.e. OTP flow (not required for Truecaller one tap flow for Truecaller users verification).

Initiate the verification for the user by calling the following method:

Swift:

TCTrueSDK.sharedManager().requestVerification(forPhone: <#PHONE_NUMBER_STRING>,countryCode: <#DEFAULT_COUNTRY_CODE>)

Objective C: [[TCTrueSDK sharedManager] requestVerificationForPhone:<#PHONE_NUMBER_STRING> countryCode:<#DEFAULT_COUNTRY_CODE>];

  • the first parameter (PHONE_NUMBER_STRING) is the 10-digit mobile number

  • the second parameter is the country code (DEFAULT_COUNTRY_CODE) of the mobile number for which the verification needs to be triggered(“IN” for India)

Once you initiate the verification using the above requestVerification() method, the below delegate method will be called along with the verification state.

Swift: func verificationStatusChanged(to verificationState: TCVerificationState)

Objective C: (void)verificationStatusChangedTo:(TCVerificationState)verificationState;

verificationStatusChanged() delegate method is called under any of the following scenarios :

  • When OTP is successfully triggered for the input mobile number. In this case, you will get the verificationState as TCVerificationState.otpInitiated

  • When the verification is successful for a particular number. In this case, you will get the verificationState as TCVerificationState.verificationComplete

  • When the user is already verified on that particular device. In this case, you will get the verificationState as TCVerificationState.verifiedBefore

Possible Verification states (TCVerificationState) :

State

Description

TCVerificationStateOTPInitiated

Returned when OTP is successfully initiated by Truecaller

TCVerificationStateOTPReceived

Returned when OTP is successfully registered by the partner to Truecaller.

TCVerificationStateVerificationComplete

OTP verification successful at Truecaller

TCVerificationStateVerifiedBefore

The user has already been signed in from this device

When verificationState is TCVerificationState.otpInitiated, you will also receive an additional parameter for the time to live i.e TTL (in seconds) which can be fetched using:- Swift TCTrueSDK.sharedManager().tokenTtl() Objective C [[TCTrueSDK sharedManager] tokenTtl];

This value determines the amount of time left to complete the verification. You can use this value to show a waiting message to your user before they can try for another attempt. Once the TTL expires, you can either auto-retry the verification by calling the requestVerification() method automatically with the same input parameters OR you can also take the user back to the number input screen to enter a different number for verification.

Once the OTP is initiated, allow the user to enter the OTP, first name and last name.

When the verification status is TCVerificationStateVerifiedBefore or TCVerificationStateVerificationComplete, it means that the user verification via Truecaller SDK is complete. In these cases, the SDK will share an additional access token with your application, which you may then use to validate the response at your server end. To fetch the access token, you may use the following code snippet:

Swift TCTrueSDK.sharedManager().accessTokenForOTPVerification()

Objective C [[TCTrueSDK sharedManager] accessTokenForOTPVerification];

After fetching the access token, you may perform the server side validation by referring to the steps mentioned in the later part of the documentation here. Below mentioned didFailToReceiveTrueProfileWithError() method will be called when some error has occurred while verifying the provided mobile number. You will receive the appropriate error message from TCError using TCError.getErrorCode(). For details of different possible error types you may encounter, please refer to the next section

Swift

func didFailToReceiveTrueProfileWithError(_ error: TCError)

Objective C

- (void)didFailToReceiveTrueProfileWithError:(nonnull TCError *)error

PreviousObjective-CNextCompleting Verification

Last updated 11 months ago