diff --git a/ios/Classes/FlutterAlibcPlugin.m b/ios/Classes/FlutterAlibcPlugin.m index dbf3cf5..eb27284 100644 --- a/ios/Classes/FlutterAlibcPlugin.m +++ b/ios/Classes/FlutterAlibcPlugin.m @@ -52,6 +52,8 @@ [_handler syncForTaoke:call result:result]; }else if([@"useAlipayNative" isEqualToString:call.method]){ [_handler useAlipayNative:call result:result]; + }else if([@"getUdid" isEqualToString:call.method]){ + [_handler getUdid:call result:result]; }else { result(FlutterMethodNotImplemented); } diff --git a/ios/Classes/Handle/FlutterAlibcHandle.h b/ios/Classes/Handle/FlutterAlibcHandle.h index 433e3e0..d1ea9a7 100644 --- a/ios/Classes/Handle/FlutterAlibcHandle.h +++ b/ios/Classes/Handle/FlutterAlibcHandle.h @@ -94,6 +94,7 @@ NS_ASSUME_NONNULL_BEGIN @param result <#result description#> */ - (void)useAlipayNative:(FlutterMethodCall *)call result:(FlutterResult)result; +- (void)getUdid:(FlutterMethodCall *)call result:(FlutterResult)result; @end NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Handle/FlutterAlibcHandle.m b/ios/Classes/Handle/FlutterAlibcHandle.m index 4f25645..48c64d6 100644 --- a/ios/Classes/Handle/FlutterAlibcHandle.m +++ b/ios/Classes/Handle/FlutterAlibcHandle.m @@ -14,6 +14,7 @@ #import "FlutterWxViewCtrlViewController.h" #import #import +#import "UTDID/UTDevice.h" @implementation FlutterAlibcHandle FlutterMethodChannel *_flutterAlibcChannel = nil; @@ -293,6 +294,14 @@ FlutterMethodChannel *_flutterAlibcChannel = nil; BOOL isNeed = [call.arguments[@"isNeed"] boolValue]; [[AlibcTradeSDK sharedInstance] setShouldUseAlizfNative:isNeed]; } + +//获取udid +- (void)getUdid:(FlutterMethodCall *)call result:(FlutterResult)result{ + NSUUID *identifierForVendor = [[UIDevice currentDevice] identifierForVendor]; + NSDictionary* map=@{@"udid" : [UTDevice utdid]}; + result(map); +} + #pragma mark - 不对flutter暴露 #pragma mark --打开page - (void)OpenPageByNewWay:(id)page BizCode:(NSString *)bizCode Call:(FlutterMethodCall *)call callback:(FlutterResult)callback{ diff --git a/lib/flutter_alibc.dart b/lib/flutter_alibc.dart index d348b01..37f1e4c 100644 --- a/lib/flutter_alibc.dart +++ b/lib/flutter_alibc.dart @@ -278,6 +278,7 @@ class FlutterAlibc { static Future getUdid() async { var map = await _channel.invokeMethod("getUdid"); + print(map); return map['udid']; } }