如何解决如何在Xamarin iOS中符合协议
强文本我正在Xamarin中实现iZettle支付SDK。我创建了绑定库,并将所有头文件转换为ApiDefintions。 我一直坚持在Xamarin中遵守iZettleSDKAuthorizationProvider协议。
[BaseType(typeof(NSObject))]
[Model,Protocol]
interface iZettleSDKAuthorizationProvider
{
// @required -(void)authorizeAccountWithCompletion:(void (^ _Nonnull)(iZettleSDKOAuthToken * _Nullable,NSError * _Nullable))completion;
[Abstract]
[Export("authorizeAccountWithCompletion:")]
void AuthorizeAccountWithCompletion(Action<iZettleSDKOAuthToken,NSError> completion);
// @required -(void)verifyAccountWithUuid:(NSUUID * _Nonnull)uuid completion:(void (^ _Nonnull)(iZettleSDKOAuthToken * _Nullable,NSError * _Nullable))completion;
[Abstract]
[Export("verifyAccountWithUuid:completion:")]
void VerifyAccountWithUuid(NSUuid uuid,Action<iZettleSDKOAuthToken,NSError> completion);
}
// @interface iZettleSDKAuthorization : NSObject <iZettleSDKAuthorizationProvider>
[BaseType(typeof(NSObject),Name = "_TtC10iZettleSDK23iZettleSDKAuthorization")]
[disableDefaultCtor]
interface iZettleSDKAuthorization : IiZettleSDKAuthorizationProvider
{
// -(instancetype _Nullable)initWithClientID:(Nsstring * _Nonnull)clientID callbackURL:(NSURL * _Nonnull)callbackURL error:(NSError * _Nullable * _Nullable)error enforcedUserAccount:(Nsstring * _Nullable (^ _Nonnull)(void))enforcedUserAccount __attribute__((objc_designated_initializer));
[Export("initWithClientID:callbackURL:error:enforcedUserAccount:")]
[DesignatedInitializer]
IntPtr Constructor(string clientID,NSUrl callbackURL,[NullAllowed] out NSError error,Func<Nsstring> enforcedUserAccount);
}
简而言之,我想要Xamarin ios等效于以下代码;
id<iZettleSDKAuthorizationProvider> authorizationProvider = [[iZettleSDKAuthorization alloc]
initWithClientID:clientId
callbackURL:[NSURL URLWithString:callbackURL]
error:&error
enforcedUserAccount:^Nsstring * _Nullable{
return [AccountManager shared].enforcedUserAccount;
}];
为shown here。这样任何人都可以帮助我,那就太好了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。