From c013c50705da3f0a1c5bb8b403217f773a56485d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Mon, 12 Apr 2021 12:01:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0ios=E8=8E=B7=E5=8F=96uuid?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/FlutterAlibcPlugin.m | 2 ++ ios/Classes/Handle/FlutterAlibcHandle.h | 1 + ios/Classes/Handle/FlutterAlibcHandle.m | 9 +++++++++ lib/flutter_alibc.dart | 1 + 4 files changed, 13 insertions(+) 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']; } }