“unrecognized selector sent to instance 0x...” occurring with AXA SDK in Xcode 9.3

Document ID : KB000093511
Last Modified Date : 30/04/2018
Show Technical Document Details
Issue:
The error “unrecognized selector sent to instance 0x...” is occurring when an AXA SDK is deployed in an IOS application. This error is causing many application crashes.
Environment:
Any version of the AXA SDK used with Xcode 9.3+.
Cause:
The AXA SDK has few libraries that require the -ObjC linker argument to build the project. Due to a bug introduced in Xcode 9.3, the -ObjC argument is ignored during linking. This causes application crashes at run time with an "unrecognized selector" exception.
Resolution:
To address this issue, please update the "OTHER_LDFLAGS" option in ca-maa-ios-sdk.xcconfig file and append the following configuration. 
OTHER_LDFLAGS=<options> -Wl -force_load $(PRODUCT_NAME)/CAMobileAppAnalytics/libCAMobileAppAnalytics.a -Wl -force_load $(PRODUCT_NAME)/CAMobileAppAnalytics/libCAMobileAppAnalytics-simulator.a 

This change will force load AXA libraries. Note: Be aware that this change assumes all AXA SDK files are placed in their default locations. If they are not, you will see build errors such as "Linker command failed" and "warning directory not found for option...". In this situation, the OTHER_LDFLAGS option needs to be updated with a correct path for your project.
OTHER_LDFLAGS=<options> -Wl -force_load <Path to>/CAMobileAppAnalytics/libCAMobileAppAnalytics.a -Wl -force_load <Path to>/CAMobileAppAnalytics/libCAMobileAppAnalytics-simulator.a 
Additional Information:
As always, contact CA Support if you have further questions.