Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A crash in [[NSData alloc] initWithBase64EncodedString:response.payload options:0] when login #22

Open
Ekulelu opened this issue Dec 16, 2019 · 3 comments

Comments

@Ekulelu
Copy link

Ekulelu commented Dec 16, 2019

There is a crash:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSPlaceholderData initWithBase64EncodedString:options:]: nil string argument'
isAppWillTerminate-false
....
0x0000000105acdfb0 -[TCTrueSDK application:continueUserActivity:restorationHandler:] (in xxx) (TCTrueSDK.m:130)
....

image

@mahsha
Copy link

mahsha commented Dec 18, 2019

you can add this check before calling
return TCTrueSDK.sharedManager().application(UIApplication.shared, continue: activity, restorationHandler: nil)
as when user press contiune in truecaller app before truecaller fetch the data the resoponse will be nil

if (activity.activityType == NSUserActivityTypeBrowsingWeb) {
               let url = activity.webpageURL
               var urlComponents: URLComponents? = nil
               if let url = url {
                   urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
               }
               let appLink = "link you add in true caller init"
               
               if ( "\(urlComponents?.scheme ?? "")://\(urlComponents?.host ?? "")" == appLink) {
                   let queryItem = urlComponents?.queryItems?.first?.value
                   let objectData = Data(base64Encoded: queryItem ?? "", options: .ignoreUnknownCharacters)
                   var object: Any? = nil
                   if let objectData = objectData {
                       object = NSKeyedUnarchiver.unarchiveObject(with: objectData)
                       if (object as? TCTrueProfileResponse) != nil {
                           return  TCTrueSDK.sharedManager().application(UIApplication.shared, continue: activity, restorationHandler: nil)
                       } else {
                           return false
                       }
                   }
               }
           }

@ankitgarg1mg
Copy link

Instead of checking error, the response should be check is it nil or not. Then only need to proceed further. Can you update this in code and share updated SDK. We are getting lot of crashes.

if (response != nil) {
// call delegate did receive true caller profile
}
else {
// process error
}

@parth0907
Copy link

Hi There,

Hope you are doing great!

First of all we highly apologies for the delay in response.

The issue that you mention is resolved in the latest version of our IOS SDK. Therefore, I would request you to update the same

Please feel free to write back via our support channel for a faster and dedicated response in case you face any confusion/issues, we will be happy to answer!

-Parth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants