forcedotcom / SalesforceMobileSDK-iOS

iOS SDK for Salesforce
Other
536 stars 418 forks source link

Mobile App Crash on Local Authentication - Salesforce Hybrid Remote SDK V11.1.0 #3714

Open VenkataramanK opened 1 month ago

VenkataramanK commented 1 month ago

Please fill out the following details:

  1. Version of Mobile SDK Used: v11.1.0
  2. Issue found in Native App or Hybrid App: Hybrid (Remote)
  3. OS Version: 17.4.1
  4. Device: iPad14,6
  5. Steps to reproduce: Clicking icon of the application, app crashes
  6. Actual behavior: Clicking icon of the application, app crashing when initialise
  7. Expected Behavior: Clicking icon of the application, displaying home screen after biometric authentication
  8. Error Log: Attached Crash Log

AppLog.docx

wmathurin commented 1 month ago

Could you try with the latest version of the Mobile SDK (12.0.1)? A number of bugs were addressed in that area.

VenkataramanK commented 1 month ago

@wmathurin : Thanks wmathurin. i will try it out. Meanwhile could you please share some other bugs id related to this context. Also, is that confirmed the bug has been fixed in V12.0 anywhere in SDK or anybody confirmed this bug has been resolved in V12.0. Please share your response..that would be grateful.

wmathurin commented 1 month ago

We have not seen your bug so I don't know for sure whether it was addressed but since we don't patch old versions of the SDK, we first need to confirm it is still happening in 12.0 before investigating further.

VenkataramanK commented 1 month ago

@wmathurin : I got a crash log analysis from apple team, it declares salesforce sdk should not call some operations in main thread. can you please look into the below url and let us know, is they any quick fix or it can taken care in next release of SDK? https://forums.developer.apple.com/forums/thread/753237?page=1#788137022

VenkataramanK commented 4 weeks ago

@wmathurin - From the Crash Log we identified, our app's last Salesforce SDK version is 9.1.0. In the latest release of our app we used Salesforce SDK version 11.1.0.

Below is the block of code(SFSDKSalesforceSDKUpgradeManager class inside + (void)upgrade method) getting crashed when attempting to check accessibilityAttribute from SFSDKKeychainHelper.

From your end, any assumptions/idea why the main thread hold for a while, would be welcome.

` if (!lastVersion || [lastVersion compare:@"9.2.1" options:NSNumericSearch] == NSOrderedAscending) { // 9.2.0 & 9.2.1 upgrade steps both need file and keychain access, if we don't have those, // abort the upgrade so that it can rerun

        **if (![SFSDKKeychainHelper accessibilityAttribute]) {**
            // Only update accessible attribute if the app isn't setting it
            [SFLogger log:[self class] level:SFLogLevelError format:@"Attempt keychain attribute update"];
            SFSDKKeychainResult *result = [SFSDKKeychainHelper setAccessibleAttribute:KeychainItemAccessibilityAfterFirstUnlockThisDeviceOnly];
            if (result.status == errSecInteractionNotAllowed) {
                [SFLogger log:[self class] level:SFLogLevelError format:@"Upgrade step skipped because keychain access not allowed"];
                return;
            }
        }

        NSArray<NSString *> *filesWithCompleteProtection = [SFSDKSalesforceSDKUpgradeManager filesWithCompleteProtection];
        if ([filesWithCompleteProtection count] > 0) {
            if (![SFApplicationHelper sharedApplication].isProtectedDataAvailable) {
                [SFLogger log:[self class] level:SFLogLevelError format:@"Upgrade step skipped because files have complete protection and protected data isn't available"];
                return;
            }
            [SFSDKSalesforceSDKUpgradeManager updateDefaultProtection:filesWithCompleteProtection];
        }
    }

`