我正在通过Flutter插件中的方法通道通过本地Braintree SDK集成Apple Pay。
当我将代码放入FlutterPlugin类中时,集成成功。
但是,当我尝试将代码放在单独的swift类中时,它不起作用。
我想念什么?
在此代码中,可以在按下ApplePay付款表中的付款按钮后触发PaymentAuthorizationViewController。
hadoop jar /usr/hadoop-3.0.0/share/hadoop/tools/lib/hadoop-streaming-3.0.0.jar \
-file ./checkinsmapper.py \
-mapper ./checkinsmapper.py \
-file ./checkinsreducer.py \
-reducer ./checkinsreducer.py \
-input /yelp_checkin.csv \
-output /output
如果我将代码放在其他类中,则不会触发paymentAuthorizationViewController。
public class SwiftBraintreePlugin:NSObject,
PKPaymentAuthorizationViewControllerDelegate,FlutterPlugin{
public static func register(with registrar:FlutterPluginRegistrar){
let channel=FlutterMethodChannel(name:"braintree",
binaryMessenger:registrar.messenger())
let instance=SwiftBraintreePlugin()
registrar.addMethodCallDelegate(instance,channel:channel)
}
public func handle(_ call:FlutterMethodCall, result:@escaping FlutterResult){
}
public func paymentAuthorizationViewController(_ controller:PKPaymentAuthorizationViewController,
didAuthorizePayment payment:PKPayment,completion:@escaping(PKPaymentAuthorizationStatus) ->Void) {
}
@available(iOS8.0, *)
public func paymentAuthorizationViewControllerDidFinish(_ controller:PKPaymentAuthorizationViewController){
viewController.dismiss(animated:true,completion:nil)
}
}