1. Import the TruecallerSDK framework in the class where you want to initialize it (for example AppDelegate) and in the class that you want to receive the profile response. Usually, this will be the ViewController responsible for displaying the True Profile info.
2. Check if the current device supports the use of TruecallerSDK and (if so) setup TruecallerSDK. We recommend this to be done in the application:didFinishLaunchingWithOptions:
Use the entire associated domain link provided by Truecaller for YOUR_APP_LINK. For example: https://si44524554ef8e45b5aa83ced4e96d5xxx.truecallerdevs.com
(including https://).
Important: Make sure you type the YOUR_APP_KEY and YOUR_APP_LINK fields correctly. If you mistype the YOUR_APP_LINK field, the permission screen in Truecaller will be shown and immediatelly dismissed. In this case, the SDK will not be able to send a corresponding error back to your app.
3. In AppDelegate implement the method application:continueUserActivity:restorationHandler: and call the corresponding method of the [TCTrueSDK sharedManager]. If the method returns false that means the activity need not be addressed by TruecallerSDK and you can handle it as desired.
4. Set the class where you want to receive TruecallerSDK events (the profile or errors) a TCTrueSDKDelegate
5. Implement the two TCTrueSDKDelegate methods
The profile object is of type TCTrueProfile (written in Objective C) which offers the following user data:
6. Set the delegate property of the [TCTrueSDK sharedManager]. Make sure you do this before you request the True Profile.
7. Requesting the True Profile data can be done automatically or manually (either in code or in the Interface Builder):
a. The TCProfileRequestButton does the True Profile Request automatically. To use the predefined buttons you need to set the Button Type to Custom and set auto-layout constraints for the button. You can then choose the True button style and corners style of the button in code or in Interface Builder using TCProfileRequestButton property buttonStyle and buttonCornersStyle:
b. If you prefer to do it yourself, you can use the method requestTrueProfile.
Important: Do not use both approaches a. and b. at the same time. Doing so will request the Truecaller profile 2 times in a row. You do not need to call requestTrueProfile if you use TCProfileRequestButton. This button includes the request in itself.
1. Import the TruecallerSDK framework in the class where you want to initialize it (for example AppDelegate) and in the class that you want to receive the profile response. Usually, this will be the ViewController responsible for displaying the True Profile info.
Swift 2.3 :
Swift 3+ :
2. Check if the current device supports the use of TruecallerSDK and (if so) setup TruecallerSDK. We recommend this to be done in the application:didFinishLaunchingWithOptions:
Swift 2.3 :
Swift 3+ :
Use the entire associated domain link provided by Truecaller for YOUR_APP_LINK. For example: https://si44524554ef8e45b5aa83ced4e96d5xxx.truecallerdevs.com
(including https://).
Important: Make sure you type the YOUR_APP_KEY and YOUR_APP_LINK fields correctly. If you mistype the YOUR_APP_LINK field, the permission screen in Truecaller will be shown and immediatelly dismissed. In this case, the SDK will not be able to send a corresponding error back to your app.
3. In AppDelegate implement the method application(application: continue userActivity: restorationHandler:) -> Bool and call the corresponding method of TCTrueSDK.sharedManager(). If the method returns false that means the activity need not be addressed by TruecallerSDK and you can handle it as desired.
Swift 2.3 :
Swift 3+ :
Swift 5 :
For apps using SceneDelegate instead of AppDelegate :
4. Set the class where you want to receive TruecallerSDK events (the profile or errors) a TCTrueSDKDelegate
Swift 2.3 :
Swift 3+ :
5. Implement the two TCTrueSDKDelegate methods
Swift 2.3 :
Swift 3+ :
The profile object is of type TCTrueProfile (written in Objective C) which offers the following user data:
6. Set the delegate property of the TCTrueSDK.sharedManager(). Make sure you do this before you request the True Profile.
Swift 2.3 :
Swift 3+ :
7. Requesting the True Profile data can be done automatically or manually (either in code or in the Interface Builder):
a. The TCProfileRequestButton does the True Profile Request automatically. To use the predefined buttons you need to set the Button Type to Custom and set auto-layout constraints for the button. You can then choose the True button style and corners style of the button in code or in Interface Builder using TCProfileRequestButton property buttonStyle and buttonCornersStyle:
Swift 2.3 :
Swift 3+ :
b. If you prefer to do it yourself, you can use the method requestTrueProfile.
Swift 2.3 :
Swift 3+ :
Important: Do not use both approaches a. and b. at the same time. Doing so will request the Truecaller profile 2 times in a row. You do not need to call requestTrueProfile if you use TCProfileRequestButton. This button includes the request in itself.