11

I have an iOS Swift project using the AWSMobileClient SDK (v2.9.9) installed with Cocoapods.

There is one problematic method that is used quite frequently in the app:

AWSMobileClient.sharedInstance().getAWSCredentials { (credentials, error) in ... }

and there is a specific fatal error that occurs:

Obtaining an identity id in another thread failed or didn't complete within 5 seconds.

On some devices, it works fine 90% of the time and only usually occurs after a sequence of steps - e.g. sign in, log out, sign in again (the method is called after sign in).

However, recently on a new device that I've been testing on it has appeared every single time.

There was another Stack question here that suggested that another AWS SDK operation may be running in parallel when getAWSCredentials is called - but after reviewing my code I'm fairly sure this isn't the case.

I've also tried running this method on the failing device to see if it would give any clues:

AWSMobileClient.sharedInstance().getIdentityId().continueWith { task -> Any? in ... }

and returns with this error:

Fetching identity id on another thread failed. Please retry by calling getIdentityId() method.

I've spent hours looking through my own code and the stack traces that led to the error and am at a dead end with thoughts on how to solve or even debug this further.

Hopefully someone will be able to suggest something to help me - thanks! :)

jacobsieradzki
  • 1,108
  • 2
  • 10
  • 32
  • Can you share details of this new device? Like iOS and Xcode version you're using. It might be necessary to downgrade the SDK. I read that they worked on major changes in version 2.7.0. Have you tried to downgrade? – Fabio Manzano Aug 30 '19 at 17:04
  • Hi Fabio, the new device is an iPhone 7 on iOS 12.4, Xcode version is 10.3. What version would you suggest downgrading the SDK to? In 2.7.0 they introduced some code breaking changes that would require me to rewrite large parts of the app and it seems like downgrading that far back unwise to me. – jacobsieradzki Sep 04 '19 at 08:18
  • Are you calling AWSMobileClient.sharedInstance().interceptApplication in the App Delegate - didFinishLaunchingWithOptions? Also double-check sure you're calling the -getAWSCredentials that is overridden in AWSMobileClientExtensions.swift, it provides locking and queuing behavior via Grand Central Dispatch. – emma ray Sep 05 '19 at 19:16
  • -interceptApplication is deprecated since SDK v2.7, but I tried anyway still with no luck. And yes, I can confirm I am using the -getAWSCredentials from AWSMobileClientExtensions.swift. – jacobsieradzki Sep 06 '19 at 11:01
  • how did you end up solving this? same problem here. – Andy Jul 27 '20 at 05:40
  • Never solved unfortunately! – jacobsieradzki Jul 28 '20 at 14:27

0 Answers0