Closed asa47 closed 2 years ago
Hello @asa47! Thank you for creating this bug report. Can you please also include further information along the following lines:
Hello @EarthyOrange, please see the following and let me know if you need additional informations:
[PayPalRetailSDK initializeSDK];
Full stack trace:
2021-08-13 13:14:32.223218+0100 POS[3584:148888]
=== TrustKit: Successfully initialized with configuration {
TSKPinnedDomains = {
"paypal.com" = {
TSKDisableDefaultReportUri = 0;
TSKEnforcePinning = 1;
TSKIncludeSubdomains = 1;
TSKPublicKeyHashes = "{(\n {length = 32, bytes = 0x5a889647 220e54d6 bd8a1681 7224520b ... 506388b9 de0f075f },\n {length = 32, bytes = 0x967b0cd9 3fcef7f2 7ce2c245 767ae9b0 ... 62909684 69686872 },\n {length = 32, bytes = 0x25b41b50 6e493095 2823a6eb 9f1d31de ... 6d71957e 384df058 },\n {length = 32, bytes = 0x59df317b fa9f4f0a b7ca514d 7772296a ... 96e57399 e364729c },\n {length = 32, bytes = 0x8bb593a9 3be1d0e8 a822bb88 7c547890 ... 54f97fb3 6b82fc26 }\n)}";
kSKExcludeSubdomainFromParentPolicy = 0;
};
"paypalobjects.com" = {
TSKDisableDefaultReportUri = 0;
TSKEnforcePinning = 1;
TSKIncludeSubdomains = 1;
TSKPublicKeyHashes = "{(\n {length = 32, bytes = 0x5a889647 220e54d6 bd8a1681 7224520b ... 506388b9 de0f075f },\n {length = 32, bytes = 0x967b0cd9 3fcef7f2 7ce2c245 767ae9b0 ... 62909684 69686872 },\n {length = 32, bytes = 0x25b41b50 6e493095 2823a6eb 9f1d31de ... 6d71957e 384df058 },\n {length = 32, bytes = 0x59df317b fa9f4f0a b7ca514d 7772296a ... 96e57399 e364729c },\n {length = 32, bytes = 0x8bb593a9 3be1d0e8 a822bb88 7c547890 ... 54f97fb3 6b82fc26 }\n)}";
kSKExcludeSubdomainFromParentPolicy = 0;
};
};
TSKSwizzleNetworkDelegates = 0;
}
2021-08-13 13:14:32.239998+0100 POS[3584:148353] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' First throw call stack: (0x19d52125c 0x1b12b6480 0x19d58cab4 0x19d58a788 0x19d40fbac 0x19d40aaf8 0x103afec2c 0x10604bae8 0x10604d32c 0x10605b76c 0x19d4a0298 0x19d49a6f8 0x19d4997d0 0x1b3bdb570 0x19fdc62d0 0x19fdcb84c 0x102b1c034 0x19d178140) libc++abi: terminating with uncaught exception of type NSException Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' terminating with uncaught exception of type NSException (lldb)
- Xcode and device version
Xcode: Version 12.5 (12E262)
MacBook Pro: MacBook Pro 15-inch 2017
Device: iOS 14.7.1 iPad (6th Generation)
- Does the sample app build and run in the same environment with the latest SDK?
Yes, it works on the sample app. It doesn't trigger the exception at `[PayPalRetailSDK initializeSDK];`
- Cocoapods version?
cocoapods-1.10.1
pod 1.10.1
- Were any changes made to the code/project to update to the latest SDK version other than pointing to a different pod version?
No, we only change the pod version from 2.1.0320297000 to 2.3.0021161010.
@asa47 Can you please add the code snippet, from your project, containing the [PayPalRetailSDK initializeSDK];
usage?
@EarthyOrange This is what we do, and please let me know if you need additional informations:
- (void)initSDK:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
[PayPalRetailSDK initializeSDK]; // The app crash after triggering this method
}];
}
- (void)performLogin:(CDVInvokedUrlCommand*)command
{
NSString* accessToken = [[command arguments] objectAtIndex:0];
NSString* refreshUrl = [[command arguments] objectAtIndex:1];
NSString* environment = [[command arguments] objectAtIndex:2];
SdkCredential *sdkCreds = [[SdkCredential alloc] initWithAccessToken:accessToken refreshUrl:refreshUrl environment:environment];
[PayPalRetailSDK initializeMerchantWithCredentials:sdkCreds completionHandler:^(PPRetailError *error, PPRetailMerchant* merchant) {
// ..
}];
}
@asa47 Thank you for sharing the code snippet. We will investigate the scenario for initializeSDK with runInBackground, but in the mean time, is it possible for you to try removing the initializeSDK code?
The initializeMerchantWithCredentials
API takes care of initializing the SDK if it is not initialized already, so can you please check if just relying on performLogin alone helps in preventing the crash?
@shupaypal Sorry for the late reply, we have looked into it and the crash is caused by wrapping the init call in the runInBackground
method. We removed it from the code and now it is working fine.
I will close the issue and thanks again for the support!
Hello, we just updated the SDK from version 2.1.0320297000 to 2.3.0021182000. After calling
[PayPalRetailSDK initializeSDK];
it throws the following exception:The SDK used to work fine with the previous version. Are we missing something? Is there any breaking change that we should be aware of?
Please let me know if you need additional informations.