Xamarin IOS Binding library for WorldPayCSE - xamarin

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

I managed to fix this if anyone needs it in the future. Ill check it into the repo. So it looks like I overlooked step 2 onthe world pay site
Alternative: Manual installation To use the manual method:
1.Download and import WorldpayCSE.framework and openssl.framework into your project. Use the GitHub releases page for this.
2.In Xcode add -ObjC to Other Linker Flags from Build Settings.
https://developer.worldpay.com/docs/wpg/clientsideencryption/ios-integration
On the properties section of both the Frameworks open.ssl and WorldPayCSE make sure you set the linker flags prop to -ObjC
Feel like an idiot but atleast its working :)

Related

Xamarin Embedded content contains Swift code

I have created binding library successfully, it is initialized properly in Xamarin.iOS app, but at specific point, the app is crashing.
I tried to implement the same on XCode, it is crashing also, but the issue has been fixed by enabling the option Embedded content contains Swift Code = true as per this answer.
So How to enable same option in Xamarin?
The use of Swift frameworks and inclusion of the Swift support libs are not officially supported in the Xamarin build process and thus you have to manually bundle the relevant Swift support libraries into your Xamarin.iOS app.
Note: You have to make sure you include the correct version of those libraries.
User Flash3001 on Github has created Nugets/packages for the Swift frameworks
https://github.com/Flash3001/Xamarin.Swift3.Support
Swift 4
Libraries:
https://www.nuget.org/packages/Xamarin.Swift4.Accelerate/
https://www.nuget.org/packages/Xamarin.Swift4.ARKit/
https://www.nuget.org/packages/Xamarin.Swift4.AssetsLibrary/
https://www.nuget.org/packages/Xamarin.Swift4.AVFoundation/
https://www.nuget.org/packages/Xamarin.Swift4.CallKit/
https://www.nuget.org/packages/Xamarin.Swift4.CloudKit/
https://www.nuget.org/packages/Xamarin.Swift4.Contacts/
https://www.nuget.org/packages/Xamarin.Swift4.Core/
https://www.nuget.org/packages/Xamarin.Swift4.CoreAudio/
https://www.nuget.org/packages/Xamarin.Swift4.CoreData/
https://www.nuget.org/packages/Xamarin.Swift4.CoreFoundation/
https://www.nuget.org/packages/Xamarin.Swift4.CoreGraphics/
https://www.nuget.org/packages/Xamarin.Swift4.CoreImage/
https://www.nuget.org/packages/Xamarin.Swift4.CoreLocation/
https://www.nuget.org/packages/Xamarin.Swift4.CoreMedia/
https://www.nuget.org/packages/Xamarin.Swift4.Darwin/
https://www.nuget.org/packages/Xamarin.Swift4.Dispatch/
https://www.nuget.org/packages/Xamarin.Swift4.Foundation/
https://www.nuget.org/packages/Xamarin.Swift4.GameplayKit/
https://www.nuget.org/packages/Xamarin.Swift4.GLKit/
https://www.nuget.org/packages/Xamarin.Swift4.HomeKit/
https://www.nuget.org/packages/Xamarin.Swift4.MapKit/
https://www.nuget.org/packages/Xamarin.Swift4.MediaPlayer/
https://www.nuget.org/packages/Xamarin.Swift4.Metal/
https://www.nuget.org/packages/Xamarin.Swift4.MetalKit/
https://www.nuget.org/packages/Xamarin.Swift4.ModelIO/
https://www.nuget.org/packages/Xamarin.Swift4.Intents/
https://www.nuget.org/packages/Xamarin.Swift4.ObjectiveC/
https://www.nuget.org/packages/Xamarin.Swift4.OS/
https://www.nuget.org/packages/Xamarin.Swift4.Photos/
https://www.nuget.org/packages/Xamarin.Swift4.QuartzCore/
https://www.nuget.org/packages/Xamarin.Swift4.RemoteMirror/
https://www.nuget.org/packages/Xamarin.Swift4.SceneKit/
https://www.nuget.org/packages/Xamarin.Swift4.SIMD/
https://www.nuget.org/packages/Xamarin.Swift4.SpriteKit/
https://www.nuget.org/packages/Xamarin.Swift4.SwiftOnoneSupport/
https://www.nuget.org/packages/Xamarin.Swift4.UIKit/
https://www.nuget.org/packages/Xamarin.Swift4.Vision/
https://www.nuget.org/packages/Xamarin.Swift4.WatchKit/
https://www.nuget.org/packages/Xamarin.Swift4.XCTest/
Swift 3
https://www.nuget.org/packages/Xamarin.Swift3.AssetsLibrary/
https://www.nuget.org/packages/Xamarin.Swift3.AVFoundation/
https://www.nuget.org/packages/Xamarin.Swift3.CallKit/
https://www.nuget.org/packages/Xamarin.Swift3.CloudKit/
https://www.nuget.org/packages/Xamarin.Swift3.Contacts/
https://www.nuget.org/packages/Xamarin.Swift3.Core/
https://www.nuget.org/packages/Xamarin.Swift3.CoreAudio/
https://www.nuget.org/packages/Xamarin.Swift3.CoreData/
https://www.nuget.org/packages/Xamarin.Swift3.CoreGraphics/
https://www.nuget.org/packages/Xamarin.Swift3.CoreImage/
https://www.nuget.org/packages/Xamarin.Swift3.CoreLocation/
https://www.nuget.org/packages/Xamarin.Swift3.CoreMedia/
https://www.nuget.org/packages/Xamarin.Swift3.Darwin/
https://www.nuget.org/packages/Xamarin.Swift3.Dispatch/
https://www.nuget.org/packages/Xamarin.Swift3.Foundation/
https://www.nuget.org/packages/Xamarin.Swift3.GameplayKit/
https://www.nuget.org/packages/Xamarin.Swift3.GLKit/
https://www.nuget.org/packages/Xamarin.Swift3.HomeKit/
https://www.nuget.org/packages/Xamarin.Swift3.MapKit/
https://www.nuget.org/packages/Xamarin.Swift3.Intents/
https://www.nuget.org/packages/Xamarin.Swift3.ObjectiveC/
https://www.nuget.org/packages/Xamarin.Swift3.OS/
https://www.nuget.org/packages/Xamarin.Swift3.Photos/
https://www.nuget.org/packages/Xamarin.Swift3.QuartzCore/
https://www.nuget.org/packages/Xamarin.Swift3.RemoteMirror/
https://www.nuget.org/packages/Xamarin.Swift3.SceneKit/
https://www.nuget.org/packages/Xamarin.Swift3.SIMD/
https://www.nuget.org/packages/Xamarin.Swift3.SpriteKit/
https://www.nuget.org/packages/Xamarin.Swift3.SwiftOnoneSupport/
https://www.nuget.org/packages/Xamarin.Swift3.UIKit/
https://www.nuget.org/packages/Xamarin.Swift3.WatchKit/
https://www.nuget.org/packages/Xamarin.Swift3.XCTest/

Issue with interacting with iPad accessory via Binding - Xamarin.iOS

I have a Barcode scanner accessory to which the iPad docks on to, hence i need to interface with the accessory to scan for barcode and use it in my application. To accomplish this, i followed the steps as enlisted here
Xamarin Hep - Link
So I went on to create a "Binding" project, added the native library i.e. ".a" file , created the APIDefinition and Structs using Sharpie and finally added the Binding project reference to my application.
In the next step, when I tried to deploy the app to iPad, encountered the error with regards to Native Linking.
In order to fix this, i mentioned the "Framework" in the LinkWith file like:
[assembly: LinkWith ("libBarCodeScannerSDK.a", SmartLink = true, ForceLoad = false, Frameworks="ExternalAccessory")]
Having done all the things stated above, I was able to deploy the app.But I am unable to make my application work with the Barcode scanner accessory. When I check the status of the scanner, its always returned as "NotConnected".
I am clueless as to how to go about debugging this issue and getting it resolved. Do appreciate, if someone can give me pointers on this.
Thanks,
Sid
most (if not all) of external accessories must set UISupportedExternalAccessoryProtocols key inside the info.plist file, see the info.plist file that the native Xcode example that came with your scanner SDK has and copy the UISupportedExternalAccessoryProtocols section to your Xamarin's app info.plist file.
Hope this helps!

Webpage doesn't open after multi language configuration

I'm a new Joomla user, and i'm configuring my website, to set a multi language switcher. After fallow all of the steps in this tutorial (https://www.youtube.com/watch?v=cm114SqvUuc) i opened the webpage, and it always shows me this error on the pic:
I tried to check all of the steps, and i think that everything's right.
Edited:
I changed to max level error reporting, and i got these errors:
Deprecated: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in >/home/sbmobili/public_html/libraries/joomla/string/string.php on line 27
Deprecated: iconv_set_encoding(): Use of iconv.input_encoding is deprecated in >/home/sbmobili/public_html/libraries/joomla/string/string.php on line 28
Deprecated: iconv_set_encoding(): Use of iconv.output_encoding is deprecated in >/home/sbmobili/public_html/libraries/joomla/string/string.php on line 29
Edited (2):
If i remove the "www" in the URL, the website opens, but without any multi language reference.
Someone knows how to solve?
Big thank's.
Actually this problem was easily fixed . I just cleaned the browser cache and it worked.

Firefox Annotator SDK tutorial, cannot get the annotator button to work

Link to the tutorial
I am trying to get to grips with Firefox SDK development using the tutorials on MDN. The annotator tutorials seem very good but CFX Run fails on the first control stage.
The tutorial uses the widget API that was deprecated in Firefox 29 but I tried downgrading Firefox 28 and the tutorial still doesn't work even when I am copy and pasting the code directly from the page code. When I come to the end of the Implementing the widget page I only get the following message when trying to click the widget icon (the first time, then nothing hapens).
(C:\Users\myname\Firefoxplayground\addon-sdk-1.16) C:\Users\myname\Firefoxplay
ground\pageMod>cfx run
Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\sigvard\appdata\local\temp\tmpg3kq0j.mozrunner'.
console.error: pagemod:
Error opening input stream (invalid filename?)
JavaScript strict warning: chrome://browser/content/urlbarBindings.xml, line 666
: reference to undefined property this._value
JavaScript error: chrome://browser/content/urlbarBindings.xml, line 648: aUrl is
undefined
The issue was caused by a bug in the Firefox SDK.
Updating to Firefox SDK 1.16 and initializing a new folder for the project solved it.

How do I use the Core Plot framework with Xcode 4?

How do I install the Core Plot framework into Xcode 4?
This older tutorial has instructions on how to install it for Xcode 3, but I could not find any similar instructions for Xcode 4. What do I need to do in order to use this framework with the newer Xcode?
I made one here that followed what I did:
http://recycled-parts.blogspot.com/2011/07/setting-up-coreplot-in-xcode-4.html
Hope it helps!
It appears that I was unable to set up core plot project for the reason that I had corrupt example project which code I was using.
This are the steps:
open a project
add quartzcore framework
add other linker flags: -ObjC -all_load
add CorePlot.xcodeproj to existing project (drag and drop)
add sample class (from examples folder, drag and drop)
drag coreplot framework from added CorePlot.xcodeproj to linked frameworks
in IB
drop object and associate it to sample class
drop custom view to window and associate it vith CPTLayerHostingView
connect object and custom view
And hat is that (may sound complicated, but can be done in under a minute)
Steps can be taken in any order, except last few.
Everithing is very similar to instructions at: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application except the way it is done in xcode4 is actually easier.
Here are screenshoots that clarify the above steps: http://www.optimae.biz/data/stackoverflow/coreplot.pdf
Hope this will help someone.

Resources