ReaderSDK Crashing on Native iOS Project using Swift

I am upgrading from Square POS API to ReaderSDK and followed all the steps mentioned here https://developer.squareup.com/docs/reader-sdk/build-on-ios.
But once the app launches, it is crashing on
SQRDReaderSDK.initialize(applicationLaunchOptions: launchOptions)
with the following message

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSAttributeDescription 0x10a2f9478> valueForUndefinedKey:]: this class is not key value coding-compliant for the key preserveValueOnDeletionInPersistentHistory.'
terminating with uncaught exception of type NSException
CoreSimulator 857.14 - Device: iPad Pro (12.9-inch) (5th generation) (078B57BE-F666-4C58-808F-E84395FF7C59) - Runtime: iOS 15.4 (19E240) - DeviceType: iPad Pro (12.9-inch) (5th generation)

Following is the stack trace

2023-04-15 06:09:51.999569-0500 BarneyBrowniPadApp[51445:8250677] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSAttributeDescription 0x10a2f9478> valueForUndefinedKey:]: this class is not key value coding-compliant for the key preserveValueOnDeletionInPersistentHistory.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff20406d44 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007fff201a4a65 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff204069dc -[NSException init] + 0
	3   Foundation                          0x00007fff207a218c -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 225
	4   Foundation                          0x00007fff207a0f68 -[NSObject(NSKeyValueCoding) valueForKey:] + 307
	5   RMMapper                            0x00000001074947ad -[NSObject(RMCopyable) copyWithZone:] + 621
	6   CoreData                            0x00007fff25baa10a -[NSEntityDescription copyWithZone:] + 730
	7   CoreData                            0x00007fff25ba9fad -[NSEntityDescription copyWithZone:] + 381
	8   CoreData                            0x00007fff25c0b1fe -[NSManagedObjectModel copyWithZone:] + 376
	9   CoreData                            0x00007fff25c090f3 +[NSManagedObjectModel modelByMergingModels:] + 152
	10  SquareReaderSDK                     0x000000010f8a065f SQRDCurrencyCodeGetISOCurrencyCode + 58081325
	11  SquareReaderSDK                     0x000000010f8a01a8 SQRDCurrencyCodeGetISOCurrencyCode + 58080118
	12  SquareReaderSDK                     0x000000010f8a02ef SQRDCurrencyCodeGetISOCurrencyCode + 58080445
	13  SquareReaderSDK                     0x000000010f6f4a5e SQRDCurrencyCodeGetISOCurrencyCode + 56329260
	14  SquareCore                          0x0000000107b80f6f -[NSObject(SQCARCSelectorAdditions) _SQC_performSelector:withObject:withObject:] + 132
	15  SquareCore                          0x0000000107b810b6 +[NSObject(SQCPrivateAdditions) _SQC_cachedPerformSelector:onObject:] + 91
	16  SquareReaderSDK                     0x000000010f894f3e SQRDCurrencyCodeGetISOCurrencyCode + 58034444
	17  SquareReaderSDK                     0x000000010f6f5006 SQRDCurrencyCodeGetISOCurrencyCode + 56330708
	18  SquareReaderSDK                     0x000000010f6f4f88 SQRDCurrencyCodeGetISOCurrencyCode + 56330582
	19  SquareReaderSDK                     0x000000010f87e404 SQRDCurrencyCodeGetISOCurrencyCode + 57941458
	20  SquareReaderSDK                     0x000000010f87ea71 SQRDCurrencyCodeGetISOCurrencyCode + 57943103
	21  SquareReaderSDK                     0x000000010c285186 SQRDCurrencyCodeGetISOCurrencyCode + 1346388
	22  SquareReaderSDK                     0x000000010c1fdc86 SQRDCurrencyCodeGetISOCurrencyCode + 792148
	23  SquareReaderSDK                     0x000000010c14007a SQRDCurrencyCodeGetISOCurrencyCode + 14920
	24  SquareReaderSDK                     0x000000010c14ad9d SQRDCurrencyCodeGetISOCurrencyCode + 59243
	25  SquareReaderSDK                     0x000000010c14aa1b SQRDCurrencyCodeGetISOCurrencyCode + 58345
	26  libdispatch.dylib                   0x0000000108c8ea5b _dispatch_client_callout + 8
	27  libdispatch.dylib                   0x0000000108c8ff24 _dispatch_once_callout + 66
	28  SquareReaderSDK                     0x000000010c14a9c4 SQRDCurrencyCodeGetISOCurrencyCode + 58258
	29  SquareReaderSDK                     0x000000010c14a425 SQRDCurrencyCodeGetISOCurrencyCode + 56819
	30  SquareReaderSDK                     0x000000010c14a13c SQRDCurrencyCodeGetISOCurrencyCode + 56074
	31  BarneyBrowniPadApp                  0x000000010641351b $s18BarneyBrowniPadApp0D8DelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtF + 427
	32  BarneyBrowniPadApp                  0x00000001064138d7 $s18BarneyBrowniPadApp0D8DelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtFTo + 183
	33  UIKitCore                           0x00007fff2508a847 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 214
	34  UIKitCore                           0x00007fff2508c538 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4128
	35  UIKitCore                           0x00007fff25091ed8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1190
	36  UIKitCore                           0x00007fff24602a92 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
	37  UIKitCore                           0x00007fff24bf6ba6 _UIScenePerformActionsWithLifecycleActionMask + 88
	38  UIKitCore                           0x00007fff2460358c __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
	39  UIKitCore                           0x00007fff24602fc9 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 252
	40  UIKitCore                           0x00007fff246033c2 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 831
	41  UIKitCore                           0x00007fff24602c6f -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 354
	42  UIKitCore                           0x00007fff2460d0b7 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178
	43  UIKitCore                           0x00007fff24ada115 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 859
	44  UIKitCore                           0x00007fff24c1402d _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 246
	45  UIKitCore                           0x00007fff2460cd3b -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 346
	46  UIKitCore                           0x00007fff2440a465 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.578 + 796
	47  UIKitCore                           0x00007fff24408e37 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 253
	48  UIKitCore                           0x00007fff2440a025 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 255
	49  UIKitCore                           0x00007fff250907f9 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 513
	50  UIKitCore                           0x00007fff24b0b112 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 355
	51  FrontBoardServices                  0x00007fff26546cdd -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 415
	52  FrontBoardServices                  0x00007fff26573216 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 102
	53  FrontBoardServices                  0x00007fff265550ef -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
	54  FrontBoardServices                  0x00007fff26572df5 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 352
	55  libdispatch.dylib                   0x0000000108c8ea5b _dispatch_client_callout + 8
	56  libdispatch.dylib                   0x0000000108c9193b _dispatch_block_invoke_direct + 295
	57  FrontBoardServices                  0x00007fff26599da3 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	58  FrontBoardServices                  0x00007fff26599c99 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 174
	59  FrontBoardServices                  0x00007fff26599dcb -[FBSSerialQueue _performNextFromRunLoopSource] + 19
	60  CoreFoundation                      0x00007fff20373833 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	61  CoreFoundation                      0x00007fff2037372b __CFRunLoopDoSource0 + 180
	62  CoreFoundation                      0x00007fff20372bf8 __CFRunLoopDoSources0 + 242
	63  CoreFoundation                      0x00007fff2036d2f4 __CFRunLoopRun + 871
	64  CoreFoundation                      0x00007fff2036ca90 CFRunLoopRunSpecific + 562
	65  GraphicsServices                    0x00007fff2cb72c8e GSEventRunModal + 139
	66  UIKitCore                           0x00007fff2508e90e -[UIApplication _run] + 928
	67  UIKitCore                           0x00007fff25093569 UIApplicationMain + 101
	68  BarneyBrowniPadApp                  0x00000001064c5933 main + 211
	69  dyld                                0x00000001071c3f21 start_sim + 10
	70  ???                                 0x0000000114f46310 0x0 + 4646527760
)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.4.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/i858674/Library/Developer/Xcode/DerivedData/BarneyBrowniPadApp-gdiwpwhcikaluyddrzlbhstibkuv/Build/Products/Debug-iphonesimulator:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.4.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/i858674/Library/Developer/Xcode/DerivedData/BarneyBrowniPadApp-gdiwpwhcikaluyddrzlbhstibkuv/Build/Products/Debug-iphonesimulator

Seems like it’s crashing on SQRDCurrencyCodeGetISOCurrencyCode. I cant find any reference of
preserveValueOnDeletionInPersistentHistory so must be something internal in SQRReader SDK.

Found the solution. The library RMMapper that was used by the app was causing the crash.

Glad to hear you were able to figure it out. :slightly_smiling_face: