I need to make use of the worldPay CSE (Client side encryption) SDK (https://developer.worldpay.com/docs/wpg/clientsideencryption) for IOS and android within xamarin forms so I have created 2 Binding libraries. I have successfully created a wrapper for android and this is working fine but I am having an issue with IOS.
I downloaded https://github.com/Worldpay/worldpay-cse-lib-ios and followed the below tutorial on creating a binding library and mapping the API definitions using objective sharpie https://www.xamboy.com/2020/07/20/creating-a-xamarin-binding-library-for-ios-and-android-part-1/
I was able to build the solution and it appears to be creating the objects from the header files but when I run worldpayCSE.Encrypt(wpCardData, out NSEncryptError) method I get the following error:
Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[NSTaggedPointerString isEmpty]: unrecognized selector sent to instance 0xff2d7cc5da80afba Native stack trace: 0 CoreFoundation 0x000000010b2ebfba __exceptionPreprocess + 242 1 libobjc.A.dylib
0x000000011c694ff5 objc_exception_throw + 48 2 CoreFoundation
0x000000010b2fad2f +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0 3 CoreFoundation
0x000000010b2f04cf forwarding + 1455 4 CoreFoundation
0x000000010b2f27a8 _CF_forwarding_prep_0 + 120 5
Test3dsecureSolution.iOS 0x000000010a6d180a -[WPCardValidator validateNumber:withExpectedLength:] + 61 6 Test3dsecureSolution.iOS 0x000000010a6d18ba -[WPCardValidator validateMonth:] + 48 7 Test3dsecureSolution.iOS 0x000000010a6d153e -[WPCardValidator validate:] + 117 8
Test3dsecureSolution.iOS 0x000000010a6d3b66 +[WorldpayCSE validate:] + 72 9 Test3dsecureSolution.iOS
0x000000010aa41089 xamarin_dyn_objc_msgSend + 217 10 ???
0x00000001592f5e10 0x0 + 5791243792
It appears to be falling over on the validation method. However when I run the native demo project in xcode it works fine so Im pretty sure the issue isn't with the framework files and I suspect I maybe missing something
I have checked the API definitions and while 2 verify tags did flag. They appear to relate to GetPublic Key and GetJson. Both don't need to be exposed to xamarin IOS and appear to be red heron
I have pushed a copy of my solution onto git hub. The encryptionmethod is trigged from the button on the about page via the dependency service to the IOS implemenation ofthe WorldPayClient.cs
https://github.com/Law85/XamarinForms.WorldPayCSEBinding
Here is also the script I ran to generate the API definitions and strut sharpie bind --output=WorldpayCSE --namespace=WorldpayCSE --sdk=iphoneos14.5 /Users/lukewinthorpe/Desktop/WorldPay/WorldpayCSE.framework/Headers/*.h -scope /Users/lukewinthorpe/Desktop/WorldPay/WorldpayCSE.framework/Headers
Any assistance anyone can throw my way would be appreciated.
Thanks Luke