From 9a59eecd621fa446d8e50ba6ff29a5b235930027 Mon Sep 17 00:00:00 2001 From: m0_75226990 Date: Tue, 14 Mar 2023 20:59:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20uts-tencentgeolocation=20=E6=8F=92?= =?UTF-8?q?=E4=BB=B6uts=E8=AF=AD=E6=B3=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utssdk/app-ios/index.uts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-ios/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-ios/index.uts index c7566dd..3190d49 100644 --- a/uni_modules/uts-tencentgeolocation/utssdk/app-ios/index.uts +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-ios/index.uts @@ -18,7 +18,7 @@ export function checkHasIntegration():boolean{ class LBSLocation implements TencentLBSLocationManagerDelegate { // 定义 locationManager 属性,类型为 TencentLBSLocationManager - locationManager: TencentLBSLocationManager + locationManager!: TencentLBSLocationManager locationOptions?: LocationOptions @@ -75,11 +75,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate { // 请求单次定位信息 this.locationManager.requestLocation(with = requestLevel, locationTimeout = 10, completionBlock = (location?: TencentLBSLocation, err?: NSError): void => { if (location != null) { - let response = new LocationResponse(); - response.name = location!.name; - response.address = location!.address; - response.latitude = Number(location!.location.coordinate.latitude); - response.longitude = Number(location!.location.coordinate.longitude); + let response: LocationResponse = { + name: location!.name, + address: location!.address, + latitude: Number(location!.location.coordinate.latitude), + longitude: Number(location!.location.coordinate.longitude) + } locationOptions.success(response); } else { locationOptions.fail(err!.localizedDescription) @@ -120,11 +121,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate { // 实现位置更新的 delegate 方法 tencentLBSLocationManager(manager: TencentLBSLocationManager, @argumentLabel("didUpdate") location: TencentLBSLocation) { - let response = new LocationResponse(); - response.name = location.name; - response.address = location.address; - response.latitude = Number(location.location.coordinate.latitude); - response.longitude = Number(location.location.coordinate.longitude); + let response: LocationResponse = { + name: location.name, + address: location.address, + latitude: Number(location.location.coordinate.latitude), + longitude: Number(location.location.coordinate.longitude) + } this.locationOptions?.success(response) } -- GitLab