① first add the UnionPay Payment SDK to the project:
② because the class library is written in C + +, you need to write a plug-in and use OC to write:
③ then creates a bridging file for OC with Swift and introduces a header file.
④ Payment on payment page call
I use the nsurlconnectiondelegate to do the network request, the method is to complete the load, call the plug-in method, this method has four parameters, the first is to put the results of the request, in fact, is the payment number (the actual development is using the server returned), the second "00" Represents the real environment, I passed here to represent the test environment, the third is to call this method of the controller, the fourth is to specify the proxy. Then after the call:
PS: After the integration of the environment, the operation will be error, errors are as follows
and the simulator or the real machine will stop at the calling page:
The solution is to find other linker flags in Bulid setting and add-OBJC, then you can!
IOS Integrated UnionPay Payment Swift