Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
7062ed4c
U
uni-api
项目概览
DCloud
/
uni-api
通知
689
Star
23
Fork
12
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7062ed4c
编写于
6月 12, 2024
作者:
zhaofengliang920817
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iOS|新增 tencent location 插件功能
上级
ec704e90
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
1038 addition
and
1 deletion
+1038
-1
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h
...-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h
+21
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocation.h
...meworks/TencentLBS.framework/Headers/TencentLBSLocation.h
+166
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationManager.h
.../TencentLBS.framework/Headers/TencentLBSLocationManager.h
+374
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h
...ks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h
+55
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist
...utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Modules/module.modulemap
.../Frameworks/TencentLBS.framework/Modules/module.modulemap
+6
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS
...utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeDirectory
...meworks/TencentLBS.framework/_CodeSignature/CodeDirectory
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements
...orks/TencentLBS.framework/_CodeSignature/CodeRequirements
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements-1
...ks/TencentLBS.framework/_CodeSignature/CodeRequirements-1
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeResources
...meworks/TencentLBS.framework/_CodeSignature/CodeResources
+177
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeSignature
...meworks/TencentLBS.framework/_CodeSignature/CodeSignature
+0
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json
...odules/uni-getLocation-tencent/utssdk/app-ios/config.json
+3
-1
uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts
uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts
+213
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
...modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
+23
-0
未找到文件。
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h
0 → 100644
浏览文件 @
7062ed4c
//
// TencentLBS.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TencentLBS.
FOUNDATION_EXPORT
double
TencentLBSVersionNumber
;
//! Project version string for TencentLBS.
FOUNDATION_EXPORT
const
unsigned
char
TencentLBSVersionString
[];
// In this header, you should import all the public headers of your framework using statements like #import <TencentLBS/PublicHeader.h>
#import <TencentLBS/TencentLBSLocation.h>
#import <TencentLBS/TencentLBSLocationManager.h>
#import <TencentLBS/TencentLBSLocationUtils.h>
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocation.h
0 → 100644
浏览文件 @
7062ed4c
//
// TencentLBSLocation.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
NS_ASSUME_NONNULL_BEGIN
#define TENCENTLBS_DEBUG 0
typedef
NS_ENUM
(
NSInteger
,
TencentLBSDRProvider
)
{
TencentLBSDRProviderError
=
-
2
,
//!< 错误,可能未开启dr
TencentLBSDRProviderUnkown
=
-
1
,
//!< 定位结果来源未知
TencentLBSDRProviderFusion
=
0
,
//!< 定位结果来源融合的结果
TencentLBSDRProviderGPS
=
1
,
//!< 定位结果来源GPS
TencentLBSDRProviderNetWork
=
2
,
//!< 定位结果来源网络
};
@interface
TencentLBSPoi
:
NSObject
<
NSSecureCoding
,
NSCopying
>
@property
(
nonatomic
,
copy
)
NSString
*
uid
;
//!< 当前POI的uid
@property
(
nonatomic
,
copy
)
NSString
*
name
;
//!< 当前POI的名称
@property
(
nonatomic
,
copy
)
NSString
*
address
;
//!< 当前POI的地址
@property
(
nonatomic
,
copy
)
NSString
*
catalog
;
//!< 当前POI的类别
@property
(
nonatomic
,
assign
)
double
longitude
;
//!< 当前POI的经度
@property
(
nonatomic
,
assign
)
double
latitude
;
//!< 当前POI的纬度
@property
(
nonatomic
,
assign
)
double
distance
;
//!< 当前POI与当前位置的距离
@end
@interface
TencentLBSLocation
:
NSObject
<
NSSecureCoding
,
NSCopying
>
/**
* 返回当前位置的CLLocation信息
*/
@property
(
nonatomic
,
strong
)
CLLocation
*
location
;
/**
* 返回当前位置的行政区划, 0-表示中国大陆、港、澳, 1-表示其他
*/
@property
(
nonatomic
,
assign
)
NSInteger
areaStat
;
/**
* 返回室内定位楼宇Id
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
buildingId
;
/**
* 返回室内定位楼层
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
buildingFloor
;
/**
* 返回室内定位类型,0表示普通定位结果,1表示蓝牙室内定位结果
*/
@property
(
nonatomic
,
assign
)
NSInteger
indoorLocationType
;
/**
*
*/
@property
(
nonatomic
,
assign
)
TencentLBSDRProvider
drProvider
;
/**
* 返回当前位置的名称,
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelName或TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
name
;
/**
* 返回当前位置的地址
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelName或TencentLBSRequestLevelAdminName有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
address
;
/**
* 返回国家编码,例如中国为156
* <b>注意:该接口涉及到WebService API,请参考https://lbs.qq.com/service/webService/webServiceGuide/webServiceOverview中的配额限制说明,
* 并将申请的有效key通过TencentLBSLocationManager的- (void)setDataWithValue: forKey:方法设置,其中key为固定值@"ReGeoCodingnKey",例如[tencentLocationManager setDataWithValue:@"您申请的key(务必正确)" forKey:@"ReGeoCodingnKey"];,否则将返回默认值0</b>
*/
@property
(
nonatomic
,
assign
)
NSInteger
nationCode
;
/**
* 返回当前位置的城市编码
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
code
;
/**
* 返回当前位置的国家
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
nation
;
/**
* 返回当前位置的省份
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
province
;
/**
* 返回当前位置的城市固话编码.
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
cityPhoneCode
;
/**
* 返回当前位置的城市
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
city
;
/**
* 返回当前位置的区县
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
district
;
/**
* 返回当前位置的乡镇
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
town
;
/**
* 返回当前位置的村
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
village
;
/**
* 返回当前位置的街道
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
street
;
/**
* 返回当前位置的街道编码
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
street_no
;
/**
* 返回当前位置周围的POI
* 仅当TencentLBSRequestLevel为TencentLBSRequestLevelPoi有返回值,否则为空
*/
@property
(
nonatomic
,
strong
,
nullable
)
NSArray
<
TencentLBSPoi
*>
*
poiList
;
/**
* 返回两个位置之间的横向距离
* @param location
*/
-
(
double
)
distanceFromLocation
:(
const
TencentLBSLocation
*
)
location
;
// 测试使用
#if TENCENTLBS_DEBUG
@property
(
nonatomic
,
copy
,
nullable
)
NSString
*
halleyTime
;
#endif
@end
NS_ASSUME_NONNULL_END
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationManager.h
0 → 100644
浏览文件 @
7062ed4c
//
// TencentLBSLocationManager.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "TencentLBSLocation.h"
NS_ASSUME_NONNULL_BEGIN
typedef
NS_ENUM
(
NSUInteger
,
TencentLBSRequestLevel
)
{
TencentLBSRequestLevelGeo
=
0
,
TencentLBSRequestLevelName
=
1
,
TencentLBSRequestLevelAdminName
=
3
,
TencentLBSRequestLevelPoi
=
4
,
};
typedef
NS_ENUM
(
NSUInteger
,
TencentLBSLocationCoordinateType
)
{
TencentLBSLocationCoordinateTypeGCJ02
=
0
,
//!< 火星坐标,即国测局坐标
TencentLBSLocationCoordinateTypeWGS84
=
1
,
//!< 地球坐标,注:如果是海外,无论设置的是火星坐标还是地球坐标,返回的都是地球坐标
};
typedef
NS_ENUM
(
NSUInteger
,
TencentLBSLocationError
)
{
TencentLBSLocationErrorUnknown
=
0
,
//!< 错误码,表示目前位置未知,但是会一直尝试获取
TencentLBSLocationErrorDenied
=
1
,
//!< 错误码,表示定位权限被禁止
TencentLBSLocationErrorNetwork
=
2
,
//!< 错误码,表示网络错误
TencentLBSLocationErrorHeadingFailure
=
3
,
//!< 错误码,表示朝向无法确认
TencentLBSLocationErrorOther
=
4
,
//!< 错误码,表示未知错误
};
typedef
NS_ENUM
(
NSInteger
,
TencentLBSDRStartCode
)
{
TencentLBSDRStartCodeSuccess
=
0
,
//!< 启动成功
TencentLBSDRStartCodeNotSupport
=
-
1
,
//!< 传感器有缺失或没有GPS芯片
TencentLBSDRStartCodeHasStarted
=
-
2
,
//!< 已经启动
TencentLBSDRStartCodeSensorFailed
=
-
3
,
//!< 传感器启动失败
TencentLBSDRStartCodeGpsFailed
=
-
4
,
//!< GPS启动失败
TencentLBSDRStartCodePermissionFailed
=
-
5
,
//!< 没有位置权限
TencentLBSDRStartCodeUnkown
=
-
6
,
//!< 未知
};
typedef
NS_ENUM
(
NSInteger
,
TencentLBSDRStartMotionType
)
{
TencentLBSDRStartMotionTypeWalk
=
2
,
//!< 步行
TencentLBSDRStartMotionTypeBike
=
3
,
//!< 骑行
};
typedef
NS_ENUM
(
NSInteger
,
TencentLBSAccuracyAuthorization
)
{
// This application has the user's permission to receive accurate location information.
TencentLBSAccuracyAuthorizationFullAccuracy
,
// The user has chosen to grant this application access to location information with reduced accuracy.
// Region monitoring and beacon ranging are not available to the application. Other CoreLocation APIs
// are available with reduced accuracy.
// Location estimates will have a horizontalAccuracy on the order of about 5km. To achieve the
// reduction in accuracy, CoreLocation will snap location estimates to a nearby point which represents
// the region the device is in. Furthermore, CoreLocation will reduce the rate at which location
// estimates are produced. Applications should be prepared to receive locations that are up to 20
// minutes old.
TencentLBSAccuracyAuthorizationReducedAccuracy
,
};
/**
* TencentLBSLocatingCompletionBlock 单次定位返回Block
*
* @param location 位置信息
* @param error 错误信息 参考 TencentLBSLocationError
*/
typedef
void
(
^
TencentLBSLocatingCompletionBlock
)(
TencentLBSLocation
*
_Nullable
location
,
NSError
*
_Nullable
error
);
@protocol
TencentLBSLocationManagerDelegate
;
@interface
TencentLBSLocationManager
:
NSObject
/**
* 当前位置管理器定位精度的授权状态
*/
@property
(
nonatomic
,
readonly
)
TencentLBSAccuracyAuthorization
accuracyAuthorization
;
/**
* 当前位置管理器定位权限的授权状态
*/
@property
(
nonatomic
,
readonly
)
CLAuthorizationStatus
authorizationStatus
;
/**
* API Key, 在使用定位SDK服务之前需要先绑定key。
*/
@property
(
nonatomic
,
copy
)
NSString
*
apiKey
;
/**
* 实现了 TencentLBSLocationManagerDelegate 协议的类指针。
*/
@property
(
nonatomic
,
weak
)
id
<
TencentLBSLocationManagerDelegate
>
delegate
;
/**
* 设定定位的最小更新距离。默认为 kCLDistanceFilterNone。
*/
@property
(
nonatomic
,
assign
)
CLLocationDistance
distanceFilter
;
/**
* 设定定位精度。默认为 kCLLocationAccuracyBest 。
*/
@property
(
nonatomic
,
assign
)
CLLocationAccuracy
desiredAccuracy
;
/**
* 指定定位是否会被系统自动暂停。默认为 YES 。
*/
@property
(
nonatomic
,
assign
)
BOOL
pausesLocationUpdatesAutomatically
;
/**
* 是否允许后台定位。默认为 NO。
* iOS 9.0 以上用户需要设置该选项并且在info.list里面Background Modes 中的 Location updates 处于选中状态才可以使用后台定位权限。iOS 9.0之前可以直接申请总是使用的权限来获得后台定位。
*
* 设置为 YES 的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
*/
@property
(
nonatomic
,
assign
)
BOOL
allowsBackgroundLocationUpdates
;
/**
* 用户的活动类型
*
* 设置用户的活动类型。默认值为 CLActivityTypeOther
*/
@property
(
nonatomic
,
assign
)
CLActivityType
activityType
;
/**
* 设置当朝向改变时,每隔多少度调用一次
* 只有当设备方向的改变值超过该属性值时才激发delegate的方法。
*/
@property
(
nonatomic
,
assign
)
CLLocationDegrees
headingFilter
;
/**
* 设置设备当前的朝向
*/
@property
(
nonatomic
,
assign
)
CLDeviceOrientation
headingOrientation
;
/**
* 连续定位的逆地理信息请求的Level。默认为TencentLBSRequestLevelGeo
*/
@property
(
nonatomic
,
assign
)
TencentLBSRequestLevel
requestLevel
;
/**
* 返回的TencentLBSLocation的location字段的坐标类型。默认为TencentLBSLocationCoordinateTypeGCJ02。
*
* 在一次定位过程中,只允许设置一次,不允许重复设置
*/
@property
(
nonatomic
,
assign
)
TencentLBSLocationCoordinateType
coordinateType
;
/**
* 指定POI的更新间隔。 默认是10s
*/
@property
(
nonatomic
,
assign
)
NSInteger
poiUpdateInterval
;
#pragma mark -
/**
* accuracyAuthorization
*
* Discussion:
* Return the current TencentLBSAccuracyAuthorization of the calling application.
*/
+
(
TencentLBSAccuracyAuthorization
)
accuracyAuthorization
;
/**
* 设置用户是否同意隐私协议政策
* <p>调用其他接口前必须首先调用此接口进行用户是否同意隐私政策的设置,传入YES后才能正常使用定位功能,否则TencentLBSLocationManager初始化不成功,返回nil,定位功能均无法使用</p>
* @param isAgree 是否同意隐私政策
*/
+
(
void
)
setUserAgreePrivacy
:(
BOOL
)
isAgree
;
/**
* 获取用户是否同意隐私政策协议
* <p>设置用户隐私后,可通过该接口判断用户隐私状态</p>
* @return isAgreePrivacy 是否同意隐私政策
*/
+
(
BOOL
)
getUserAgreePrivacy
;
#pragma mark -
-
(
void
)
requestWhenInUseAuthorization
;
-
(
void
)
requestAlwaysAuthorization
;
/**
* 当前属于模糊定位状态时,通过该接口请求暂时的完全定位精度的权限
* @param purposeKey 需要在info.plist中配置NSLocationTemporaryUsageDescriptionDictionary key值和对应的申请该权限的描述理由
* @param completion 在弹框让用户选择后的用户的反馈,如果用户授予该权限,block中的参数为nil,如果未授予,block中的参数将为PurposeKey对于的key的描述(如PurposeKey=TemporaryPurposKey_1)
*/
-
(
void
)
requestTemporaryFullAccuracyAuthorizationWithPurposeKey
:(
NSString
*
)
purposeKey
completion
:(
void
(
^
)(
NSError
*
))
completion
;
/**
* 当前属于模糊定位状态时,通过该接口请求暂时的完全定位精度的权限
* @param purposeKey 需要在info.plist中配置NSLocationTemporaryUsageDescriptionDictionary key值和对应的申请该权限的描述理由
*/
-
(
void
)
requestTemporaryFullAccuracyAuthorizationWithPurposeKey
:(
NSString
*
)
purposeKey
;
#pragma mark -
/**
* 获取定位SDK的版本
*/
+
(
NSString
*
)
getLBSSDKVersion
;
/**
* 获取定位SDK的构建日期
*/
+
(
NSString
*
)
getLBSSDKbuild
;
#pragma mark -
/**
* 向SDK内部设置数据,以满足定制的需求
* @param value
* @param key
*/
-
(
void
)
setDataWithValue
:(
NSString
*
)
value
forKey
:(
NSString
*
)
key
;
/**
* 单次定位
*
* 该方法为下面方法的一层封装。
* level默认是TencentLBSRequestLevelPoi
* timeout默认是10s
*/
-
(
BOOL
)
requestLocationWithCompletionBlock
:(
TencentLBSLocatingCompletionBlock
)
completionBlock
;
/**
* 单次定位
*
* 注意:不能连续调用该接口,需在上一次返回之后才能再次发起调用。该接口兼容iOS 7.0及以上,因iOS 9.0系统提供单次定位能力,故在9.0以上会调用系统单次定位接口,9.0之前SDK完成封装。可以通过调用cancelRequestLocation来取消。
*
* @param level 可以根据此参数来对应的获取POI信息
* @param timeout 表示获取POI的超时时间。
* @param completionBlock 单次定位完成后的Block
*/
-
(
BOOL
)
requestLocationWithRequestLevel
:(
TencentLBSRequestLevel
)
level
locationTimeout
:(
NSTimeInterval
)
timeout
completionBlock
:(
TencentLBSLocatingCompletionBlock
)
completionBlock
;
/**
* 取消单次定位
**/
-
(
void
)
cancelRequestLocation
;
/**
* 开始连续定位
*/
-
(
void
)
startUpdatingLocation
;
/**
* 停止连续定位
*/
-
(
void
)
stopUpdatingLocation
;
/**
* 开启更新定位朝向
*/
-
(
void
)
startUpdatingHeading
;
/**
* 结束更新定位朝向
*/
-
(
void
)
stopUpdatingHeading
;
/**
* 停止展示定位朝向校准提示
*/
-
(
void
)
dismissHeadingCalibrationDisplay
;
#pragma mark - PDR 对外接口
/**
* 主动获取DR实时融合位置,调用startDrEngine:成功后才可能有值,业务可根据自己的频率主动获取
* @return DR融合后的定位结果
*/
-
(
TencentLBSLocation
*
)
getPosition
;
/**
* 启动DR引擎。引擎会自动获取传感器和GPS数据,并进行位置计算。
* 启动后DR引擎会主动开启CLLocationManager startUpdatingLocation。
*
* 注意:请确保调用之前已获取位置权限(使用期间或者始终允许)
*
* @param type 运动类型 目前支持,参考TencentLBSDRStartMotionType
* @return 返回码,参考TencentLBSDRStartCode
*/
-
(
TencentLBSDRStartCode
)
startDrEngine
:(
TencentLBSDRStartMotionType
)
type
;
/**
* 停止DR引擎。内部有极短时间延迟,若在此期间调用TencentLBSLocationManager startDrEngine:可能导致启动不成功。
*/
-
(
void
)
terminateDrEngine
;
/**
* 是否支持DR引擎
* @return
*/
-
(
BOOL
)
isSupport
;
#pragma mark - test used
// 测试使用
#if TENCENTLBS_DEBUG
+
(
void
)
upLoadData
;
+
(
NSData
*
)
getLocationLog
;
+
(
void
)
newLocationLog
;
#endif
@end
#pragma mark - TencentLBSLocationManagerDelegate
/**
* TencentLBSLocationManagerDelegate
* 定义了发生错误时的错误回调方法,连续定位的回调方法等。
*/
@protocol
TencentLBSLocationManagerDelegate
<
NSObject
>
@optional
/**
* 当定位发生错误时,会调用代理的此方法
*
* @param manager 定位 TencentLBSLocationManager 类
* @param error 返回的错误,参考 TencentLBSLocationError
*/
-
(
void
)
tencentLBSLocationManager
:(
TencentLBSLocationManager
*
)
manager
didFailWithError
:(
NSError
*
)
error
;
/**
* 连续定位回调函数
*
* @param manager 定位 TencentLBSLocationManager 类
* @param location 定位结果
*/
-
(
void
)
tencentLBSLocationManager
:(
TencentLBSLocationManager
*
)
manager
didUpdateLocation
:(
TencentLBSLocation
*
)
location
;
/**
* 定位权限状态改变时回调函数
* @deprecated 在iOS 14及以上废弃,由tencentLBSDidChangeAuthorization:代替
* @param manager 定位 TencentLBSLocationManager 类
* @param status 定位权限状态
*/
-
(
void
)
tencentLBSLocationManager
:(
TencentLBSLocationManager
*
)
manager
didChangeAuthorizationStatus
:(
CLAuthorizationStatus
)
status
;
/**
* 定位权限状态改变时回调函数
* @param manager 定位 TencentLBSLocationManager 类,由此访问authorizationStatus,accuracyAuthorization
*/
-
(
void
)
tencentLBSDidChangeAuthorization
:(
TencentLBSLocationManager
*
)
manager
;
/**
* 定位朝向改变时回调函数
*
* @param manager 定位 TencentLBSLocationManager 类
* @param newHeading 新的定位朝向
*/
-
(
void
)
tencentLBSLocationManager
:(
TencentLBSLocationManager
*
)
manager
didUpdateHeading
:(
CLHeading
*
)
newHeading
;
/**
* 是否展示定位朝向校准提示的回调函数
*
* @param manager 定位 TencentLBSLocationManager 类
*/
-
(
BOOL
)
tencentLBSLocationManagerShouldDisplayHeadingCalibration
:(
TencentLBSLocationManager
*
)
manager
;
/**
* 只是内部调试使用,外部不应实现该接口
*/
-
(
void
)
tencentLBSLocationManager
:(
TencentLBSLocationManager
*
)
manager
didThrowLocation
:(
TencentLBSLocation
*
)
location
;
@end
NS_ASSUME_NONNULL_END
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h
0 → 100644
浏览文件 @
7062ed4c
//
// TencentLBSLocationUtils.h
// TencentLBS
//
// Created by mirantslu on 16/8/11.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@class
TencentLBSLocation
;
NS_ASSUME_NONNULL_BEGIN
@interface
TencentLBSLocationUtils
:
NSObject
/**
* 计算两个坐标点的距离
*/
+
(
double
)
distanceBetweenTwoCoordinate2D
:(
const
CLLocationCoordinate2D
*
)
coordinate
coordinateTwo
:(
const
CLLocationCoordinate2D
*
)
coordinate2
;
/**
* 计算两个location的距离
*/
+
(
double
)
distanceBetweenTwoCLLocations
:(
const
CLLocation
*
)
location
locationTwo
:(
const
CLLocation
*
)
location2
;
/**
* 计算两个TencentLBSLocation的距离
*/
+
(
double
)
distanceBetweenTwoTencentLBSLocations
:(
const
TencentLBSLocation
*
)
location
locationTwo
:(
const
TencentLBSLocation
*
)
location2
;
/**
* 判断经纬度是否在国内
*
*/
+
(
BOOL
)
isInRegionWithLatitude
:(
double
)
latitude
longitude
:(
double
)
longitude
;
/**
* wgs84坐标转成gcj02坐标
*/
+
(
CLLocationCoordinate2D
)
WGS84TOGCJ02
:(
CLLocationCoordinate2D
)
coordinate
;
@end
@interface
TencentLBSServiceManager
:
NSObject
/**
* 设置ID,如QQ号,微信号或是其他的登录账号,可用在发布前联调使用
*/
@property
(
atomic
,
copy
)
NSString
*
deviceID
;
+
(
instancetype
)
sharedInsance
;
@end
NS_ASSUME_NONNULL_END
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Modules/module.modulemap
0 → 100644
浏览文件 @
7062ed4c
framework module TencentLBS {
umbrella header "TencentLBS.h"
export *
module * { export * }
}
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeDirectory
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements-1
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeResources
0 → 100644
浏览文件 @
7062ed4c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
files
</key>
<dict>
<key>
Headers/TencentLBS.h
</key>
<data>
hPC0/pGd4xrqNOXCT59Bc4EZx1o=
</data>
<key>
Headers/TencentLBSLocation.h
</key>
<data>
NTNAtRb6zd+vtrq8nFcrm/TvTno=
</data>
<key>
Headers/TencentLBSLocationManager.h
</key>
<data>
CqufUOM9qpXc8PkBQcTH7nFlxHU=
</data>
<key>
Headers/TencentLBSLocationUtils.h
</key>
<data>
ctiCEOKB25KPpldhCiCitDpWjsc=
</data>
<key>
Info.plist
</key>
<data>
dF6t7k2l2ACuPcw4w8e+8pX3Ds8=
</data>
<key>
Modules/module.modulemap
</key>
<data>
jS4bVEIZ8y6+mkDDypFhD0RkQVg=
</data>
</dict>
<key>
files2
</key>
<dict>
<key>
Headers/TencentLBS.h
</key>
<dict>
<key>
hash
</key>
<data>
hPC0/pGd4xrqNOXCT59Bc4EZx1o=
</data>
<key>
hash2
</key>
<data>
rXSLg9Gmqf/qi8hc0spd2V99ElDyGiIgDgvN30bahIQ=
</data>
</dict>
<key>
Headers/TencentLBSLocation.h
</key>
<dict>
<key>
hash
</key>
<data>
NTNAtRb6zd+vtrq8nFcrm/TvTno=
</data>
<key>
hash2
</key>
<data>
LmWBqRV/iCuLqRmuUPDGqTOz3n2XBrAIRkPpulu9Dms=
</data>
</dict>
<key>
Headers/TencentLBSLocationManager.h
</key>
<dict>
<key>
hash
</key>
<data>
CqufUOM9qpXc8PkBQcTH7nFlxHU=
</data>
<key>
hash2
</key>
<data>
ozYu6o4odbCMlj5n6GijSLmHlND06j8bgS/wHNmwwkI=
</data>
</dict>
<key>
Headers/TencentLBSLocationUtils.h
</key>
<dict>
<key>
hash
</key>
<data>
ctiCEOKB25KPpldhCiCitDpWjsc=
</data>
<key>
hash2
</key>
<data>
clmnufMVF2VLg4uOOY70pixlfbrZK20rr/iOxOF4+E4=
</data>
</dict>
<key>
Modules/module.modulemap
</key>
<dict>
<key>
hash
</key>
<data>
jS4bVEIZ8y6+mkDDypFhD0RkQVg=
</data>
<key>
hash2
</key>
<data>
j/3Yn2sASML4eiVUc877N1Qdw84cRUiapBx3Gc88OUI=
</data>
</dict>
</dict>
<key>
rules
</key>
<dict>
<key>
^.*
</key>
<true/>
<key>
^.*\.lproj/
</key>
<dict>
<key>
optional
</key>
<true/>
<key>
weight
</key>
<real>
1000
</real>
</dict>
<key>
^.*\.lproj/locversion.plist$
</key>
<dict>
<key>
omit
</key>
<true/>
<key>
weight
</key>
<real>
1100
</real>
</dict>
<key>
^Base\.lproj/
</key>
<dict>
<key>
weight
</key>
<real>
1010
</real>
</dict>
<key>
^version.plist$
</key>
<true/>
</dict>
<key>
rules2
</key>
<dict>
<key>
.*\.dSYM($|/)
</key>
<dict>
<key>
weight
</key>
<real>
11
</real>
</dict>
<key>
^(.*/)?\.DS_Store$
</key>
<dict>
<key>
omit
</key>
<true/>
<key>
weight
</key>
<real>
2000
</real>
</dict>
<key>
^.*
</key>
<true/>
<key>
^.*\.lproj/
</key>
<dict>
<key>
optional
</key>
<true/>
<key>
weight
</key>
<real>
1000
</real>
</dict>
<key>
^.*\.lproj/locversion.plist$
</key>
<dict>
<key>
omit
</key>
<true/>
<key>
weight
</key>
<real>
1100
</real>
</dict>
<key>
^Base\.lproj/
</key>
<dict>
<key>
weight
</key>
<real>
1010
</real>
</dict>
<key>
^Info\.plist$
</key>
<dict>
<key>
omit
</key>
<true/>
<key>
weight
</key>
<real>
20
</real>
</dict>
<key>
^PkgInfo$
</key>
<dict>
<key>
omit
</key>
<true/>
<key>
weight
</key>
<real>
20
</real>
</dict>
<key>
^embedded\.provisionprofile$
</key>
<dict>
<key>
weight
</key>
<real>
20
</real>
</dict>
<key>
^version\.plist$
</key>
<dict>
<key>
weight
</key>
<real>
20
</real>
</dict>
</dict>
</dict>
</plist>
uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeSignature
0 → 100644
浏览文件 @
7062ed4c
文件已添加
uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json
浏览文件 @
7062ed4c
{
"deploymentTarget"
:
"9"
"frameworks"
:
[
"libz.1.2.5.tbd"
]
}
\ No newline at end of file
uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts
0 → 100644
浏览文件 @
7062ed4c
import { CLLocationManager, CLAuthorizationStatus } from "CoreLocation"
import { TencentLBSLocationManager, TencentLBSLocation, TencentLBSRequestLevel, TencentLBSLocationManagerDelegate } from "TencentLBS"
import { NSError, Bundle } from "Foundation"
import { GetLocationOptions, GetLocationSuccess } from "../interface.uts"
/**
* 判断当前是否是自定义基座
*/
export function checkHasIntegration() : boolean {
// todo
return true
}
/**
* 定位 LBSLocation 类,封装定位相关方法
*/
class LBSLocation implements TencentLBSLocationManagerDelegate {
// 定义 locationManager 属性,类型为 TencentLBSLocationManager
locationManager! : TencentLBSLocationManager
locationOptions ?: GetLocationOptions
// 初始化 locationManager 方法
configLocationManager() : boolean {
if (this.locationManager == null) {
// 从 info.plist 中读取 apiKey
const apiKey = Bundle.main.infoDictionary?.["TencentLBSAPIKey"]
// infoDictionary 获取的值类型为 any?
if (apiKey == null) {
// 如果 apiKey 为 null 返回 false
console.log("apiKey 未配置")
return false
}
// 调用API前需要设置同意用户隐私协议
TencentLBSLocationManager.setUserAgreePrivacy(true)
// 初始化 locationManager 实例对象
this.locationManager = new TencentLBSLocationManager()
// 设置 apiKey (因为 apiKey 是 any?类型,需要转成 string 类型赋值)
this.locationManager.apiKey = apiKey! as string;
this.locationManager.delegate = this
}
return true
}
// 请求定位权限
requestPremission() {
if (this.configLocationManager()) {
const status = CLLocationManager.authorizationStatus()
// 如果未获取过定位权限,则发起权限请求
if (status == CLAuthorizationStatus.notDetermined) {
this.locationManager.requestWhenInUseAuthorization()
} else if (status == CLAuthorizationStatus.denied || status == CLAuthorizationStatus.restricted) {
let ret = new UniError("uni-getLocation-tencent", -30, "permission missed.");
options.fail?.(ret)
options.complete?.(ret)
}
}
}
// 获取单次位置信息
getLocation(locationOptions : GetLocationOptions) : boolean {
// 初始化 locationManager
if (!this.configLocationManager()) {
// 初始化失败返回 false
return false
}
this.locationOptions = locationOptions
const status = CLLocationManager.authorizationStatus()
if (status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse) {
// 是否需要返回逆地理编码
let requestLevel = TencentLBSRequestLevel.geo
if (locationOptions.geocode) {
requestLevel = TencentLBSRequestLevel.name
}
// 请求单次定位信息
this.locationManager.requestLocation(with = requestLevel, locationTimeout = 10, completionBlock = (location ?: TencentLBSLocation, err ?: NSError) : void => {
if (location != null) {
// 判断 address 是否有值
var address = ""
if (location!.address != null) {
address = location!.address!
}
let response : GetLocationSuccess = {
latitude: Number(location!.location.coordinate.latitude),
longitude: Number(location!.location.coordinate.longitude),
speed: Number(location!.location.speed),
altitude: Number(location!.location.altitude),
accuracy: Number(location!.location.horizontalAccuracy),
verticalAccuracy: Number(location!.location.verticalAccuracy),
horizontalAccuracy: Number(location!.location.horizontalAccuracy),
address: address
}
locationOptions.success?.(response)
locationOptions.complete?.(response);
} else {
let ret = new UniError("uni-getLocation-tencent", -10, err!.localizedDescription);
locationOptions.fail?.(ret)
locationOptions.complete?.(ret)
}
})
} else {
this.requestPremission()
}
return true
}
// 监听位置变化
watchPosition(locationOptions : GetLocationOptions) {
// 初始化 locationManager
if (!this.configLocationManager()) {
return
}
if (locationOptions.geocode) {
this.locationManager.requestLevel = TencentLBSRequestLevel.name
} else {
this.locationManager.requestLevel = TencentLBSRequestLevel.geo
}
this.locationOptions = locationOptions
this.locationManager.startUpdatingLocation()
}
// 清除监听
clearWatch() {
// 初始化 locationManager
if (!this.configLocationManager()) {
return
}
this.locationManager.stopUpdatingLocation()
}
// 实现定位出错的 delegate 方法
tencentLBSDidChangeAuthorization(manager : TencentLBSLocationManager) {
const status = this.getAuthorizationStatus()
if (status == CLAuthorizationStatus.denied || status == CLAuthorizationStatus.restricted) {
let ret = new UniError("uni-getLocation-tencent", -30, "permission missed.");
options.fail?.(ret)
options.complete?.(ret)
} else if (status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse) {
this.getLocation(this.locationOptions)
}
}
tencentLBSLocationManager(manager : TencentLBSLocationManager, @argumentLabel("didFailWithError") error : NSError) {
let ret = new UniError("uni-getLocation-tencent", -10, error.localizedDescription);
this.locationOptions?.fail?.(ret)
this.locationOptions?.complete?.(ret)
}
// 实现位置更新的 delegate 方法
tencentLBSLocationManager(manager : TencentLBSLocationManager, @argumentLabel("didUpdate") location : TencentLBSLocation) {
// 判断 address 是否有值
var address = ""
if (location.address != null) {
address = location.address!
}
let response : GetLocationSuccess = {
latitude: Number(location.location.coordinate.latitude),
longitude: Number(location.location.coordinate.longitude),
speed: Number(location.location.speed),
altitude: Number(location.location.altitude),
accuracy: Number(location.location.horizontalAccuracy),
verticalAccuracy: Number(location.location.verticalAccuracy),
horizontalAccuracy: Number(location.location.horizontalAccuracy),
address: address
}
this.locationOptions?.success?.(response)
this.locationOptions?.complete?.(response)
}
}
const LBSLocationTool : LBSLocation = new LBSLocation()
/**
* 请求定位权限方法
*/
export function requestPremission() {
LBSLocationTool.requestPremission()
}
/*
* 获取位置信息方法(单次定位)
*/
export function getLocation(locationOptions : GetLocationOptions) : boolean {
return LBSLocationTool.getLocation(locationOptions)
}
/**
* 持续监听位置变化
*/
export function watchPosition(locationOptions : GetLocationOptions) {
LBSLocationTool.watchPosition(locationOptions)
}
/**
* 关闭监听位置变化
*/
export function clearWatch() {
LBSLocationTool.clearWatch()
}
uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
0 → 100644
浏览文件 @
7062ed4c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
TencentLBSAPIKey
</key>
<string>
WZCBZ-OLPCU-TJJVJ-4LZTE-SSG5O-6JFEM
</string>
<key>
NSLocationAlwaysAndWhenInUseUsageDescription
</key>
<string>
允许使用定位权限吗
</string>
<key>
NSLocationAlwaysUsageDescription
</key>
<string>
允许一直使用定位权限
</string>
<key>
NSLocationWhenInUseUsageDescription
</key>
<string>
允许仅在app运行期间使用定位权限
</string>
<key>
NSLocationTemporaryUsageDescriptionDictionary
</key>
<dict>
<key>
key1111
</key>
<string>
获取准确的位置信息
</string>
</dict>
<key>
UIBackgroundModes
</key>
<array>
<string>
location
</string>
</array>
</dict>
</plist>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录