Please refer to this section in case you face issues during the app redirection from your app to Truecaller app or vice versa, during the verification flow.
Truecaller SDK uses universal links to handle the redirection between Truecaller app and your app. The process involves 4 steps, as defined below :
User taps the “Sign up with Truecaller” option on your app
Universal link opens Truecaller app
User taps “Continue” button on the Truecaller verification screenD. Universal links opens your app
How Universal Links works
Associated domains are used to notify the OS that these are the universal links supported by Truecaller SDK.
On tapping a URL or when the app calls openURL request, the OS will check if any of those apps have an associated domain related to the URL which is being opened.
If there is one, the OS tries to check for AASA ( apple-app-site-association ) files related to the domain and if the file consists of the path, it opens the app and transfers control to the app.
If any of the above is missing ( the AASA or the path), it will redirect the url to Safari.
What are associated domains
We need to host a file named AASA ( apple-app-site-association ), which has all the URLs or URL extensions, which can be used to open the app.
For example: If you have your app named "xyz" and you need to open your app on tapping a url https://xyz.com/register , you need to host an AASA file under the url https://xyz.com/apple-app-site-association.
Example of a sample AASA File to open your app for URL: https://xyz.com/register
We already cover the steps for creating and hosting the AASA file for you on registering your app in truecallerdevs.com.
You can check if the AASA for your app is available at: YOUR_APPLINK( provided by Truecaller )/.well-known/apple-app-site-association
It should look like: https://si44524554ef8e45b5aa83ced4e96d5xxx.truecallerdevs.com/.well-known/apple-app-site-association P.S : change the italic part to your app link.
How is the OS is notified about Associated Domains
Apple documentation on associated domains can be found here. Once you enable the associated domain capability for your app id, you can add associated domains entitlements with the necessary app links and web credentials. This is one of the steps in Truecaller SDK integration.
The OS on first installation of your app will try hitting these URLs for ./well-known/apple-app-site-association endpoints and if there is a file at the endpoint, it is downloaded to the OS. If the file is downloaded without any error, all the urls you specified will take the user to the app and if not, you will be redirected to Safari browser as if trying to open a normal URL. If there is an error in downloading the AASA file, we as the SDK or your app will not be manually able to download the file and hence it will keep on redirecting to safari. There is a three hour window of retry for AASA files depending on different status codes, that is the OS will retry downloading the AASA file after 3 hours and if it succeeds, all the redirections to your app works properly.
What to do if you face the safari redirection issue while testing the Truecaller iOS SDK integration with your app ?
If you encounter the safari redirection issue while integrating the Truecaller SDK with your iOS app, that probably means there’s some issue in downloading the AASA file for either your application or for the Truecaller app on your device. In such a scenario, you should try uninstalling and reinstalling your app build as well as Truecaller app from the device you are testing on, and re-try the flow after sometime. Usually, it may take a few hours ( as mentioned in the above section ) for the retry mechanism to kick in and download the updated AASA file on the device. Once that is successful, the flow should work absolutely fine.
In case of error, didFailToReceiveTrueProfileWithError: will return an object of type TCError (a subclass of NSError). You can get the error code by invoking the method getErrorCode on the TCError object. The list of possible TCTrueSDKErrorCode values can be found in the API documentation.
Error Code
Description
1
App Key is Missing. The App Key is a mandatory field. It is provided to you by Truecaller.
2
App Link is Missing. The App Link is a mandatory field. It is provided to you by Truecaller.
3
The user has decided to cancel (abort) the operation of providing TrueProfile info to your app.
4
The user has not signed in using the Truecaller app yet.
5
The SDK version is old and not compatible with the Truecaller app.
6
The Truecaller app version is old and not compatible with the SDK version.
7
Current version of iOS is not supported.
8
Truecaller App is Not Installed. The Truecaller app is not installed.
9
Network Error occurred in network communication or no network connectivity
10
Truecaller internal error.
11
The user has not been authorized by Truecaller servers.
12
The credentials cannot be verified. Internal error.
13
The Profile content is not valid. Internal error.
14
Bad request. Internal error.
15
Verification Failed because the response signature could not be verified. Internal error.
16
The request's nonce does not match the nonce in response. Internal error.
17
View delegate is Nil or not set.
18
Invalid first name or last name.
19
Cannot open app because Universal Link failed
20
Please add Url Scheme to plist