Phase 4.E + Phase 5 + Phase 3.C 七牛上传:代码侧 SDK 接入(SPM 优先 / Vendor 兜底)

选型(CLAUDE.md ADR-006「SPM 优先 + Vendor xcframework 兜底」):
- 微信 → SPM(Tencent 官方 https://github.com/Tencent/WechatOpenSDK-XCFramework);
  项目方下载的 WechatOpenSDK-NoPay.xcframework 已撤出 Vendor,docs/res 内副本作离线备份
- 高德 → Vendor 手动(官方未提供 SPM;Vendor/AMap/{AMapFoundationKit,AMapLocationKit}.framework
  随仓库分发,fat .framework 同时含 x86_64 + arm64,Do Not Embed)
- 七牛 → SPM(https://github.com/qiniu/objc-sdk v8.9.x)

代码侧(全部 #if canImport 守卫,Xcode 加 SDK 前编译为 no-op):
- Source/SDK/WeChat/WeChatSDK.swift:WXApi.registerApp + handleOpenURL(沿用 msext AppID
  wx586a9b321e56efb7,universalLink 空字符串走非 ULAPI 路径)
- Source/SDK/WeChat/WeChatManager.swift:WXApiDelegate + state UUID 配对的 authorize +
  FIFO 串行 share async/await wrapper
- Source/Login/WeChatAuth.swift:客户端直拼 sns/oauth2/access_token + sns/userinfo →
  7 字段(Province 大写 P / city 经 danbian 去单引号),沿用 msext 同款路径
- Source/SDK/AMap/AMapWrapper.swift:iOS 14+ 隐私合规 3 步 + apiKey 注入
- Source/Location/LocationService.swift:actor + AMapLocationManager 异步包装 + 9 字段
- Source/Network/QiniuConfig.swift:4 项常量沿用 msext(AccessKey/SecretKey/Bucket/Domain)
- Source/Network/QiniuTokenSigner.swift:纯 Swift CryptoKit HMAC-SHA1 + Base64URL 自签
  token(与 msext QiniuManager.m:200-230 等价,不依赖 Qiniu SDK 工作)
- Source/Network/QiniuUploader.swift:actor 包 QNUploadManager async/await

Handler 升级:
- AccreditLoginHandler:拉起授权 → 反向 callback sharelogin 7 字段
- WechatShare:真实链接分享(type=2/3 截图待 Phase 4.F)
- StartLocationHandler:真实定位 → 9 字段(latitude/longitude string, province 小写 p)

生命周期:
- AppDelegate.didFinishLaunchingWithOptions:WeChatSDK.register + AMapWrapper.bootstrap
- SceneDelegate.openURLContexts:WeChatSDK.handleOpenURL 接入回调
- BackGameDataHandler:子游戏 backgameData pop 时 WXApi.delegate=nil + LocationService.stop()

Info.plist:CFBundleURLTypes 加 wx586a9b321e56efb7;LSApplicationQueriesSchemes 追加
weixin/weixinULAPI/weixinURLParamsAPI;NSLocationWhenInUseUsageDescription +
NSMicrophoneUsageDescription(gamehallname 中文文案)。

.gitignore:排除 docs/res/{AMap_iOS_Loc_ALL,objc-sdk-8.9.2}/(235MB 项目方下载副本,
已走 SPM/Vendor 接入不需要副本)。

文档:docs/SDK-Integration-Guide.md 重写 §A 用户手动 Xcode UI 三步(SPM × 2 +
Add Files × 2);Vendor/{AMap,WechatSDK}/README.md 记录各自接入路径选型。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-22 22:22:23 +08:00
co-authored by Claude Opus 4.7
parent a2baf742b6
commit 1d7e258130
47 changed files with 3226 additions and 273 deletions
@@ -0,0 +1,260 @@
//===--- AMapDemangleNodes.def - Demangling Tree Metaprogramming ----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines macros useful for macro-metaprogramming with nodes in
// the demangling tree.
//
//===----------------------------------------------------------------------===//
/// NODE(ID)
/// The node's enumerator value is Node::Kind::ID.
/// CONTEXT_NODE(ID)
/// Nodes that can serve as contexts for other entities.
#ifndef CONTEXT_NODE
#define CONTEXT_NODE(ID) NODE(ID)
#endif
CONTEXT_NODE(Allocator)
CONTEXT_NODE(AnonymousContext)
NODE(AnyProtocolConformanceList)
NODE(ArgumentTuple)
NODE(AssociatedType)
NODE(AssociatedTypeRef)
NODE(AssociatedTypeMetadataAccessor)
NODE(DefaultAssociatedTypeMetadataAccessor)
NODE(AssociatedTypeWitnessTableAccessor)
NODE(BaseWitnessTableAccessor)
NODE(AutoClosureType)
NODE(BoundGenericClass)
NODE(BoundGenericEnum)
NODE(BoundGenericStructure)
NODE(BoundGenericProtocol)
NODE(BoundGenericOtherNominalType)
NODE(BoundGenericTypeAlias)
NODE(BoundGenericFunction)
NODE(BuiltinTypeName)
NODE(CFunctionPointer)
CONTEXT_NODE(Class)
NODE(ClassMetadataBaseOffset)
NODE(ConcreteProtocolConformance)
CONTEXT_NODE(Constructor)
NODE(CoroutineContinuationPrototype)
CONTEXT_NODE(Deallocator)
NODE(DeclContext)
CONTEXT_NODE(DefaultArgumentInitializer)
NODE(DependentAssociatedConformance)
NODE(DependentAssociatedTypeRef)
NODE(DependentGenericConformanceRequirement)
NODE(DependentGenericParamCount)
NODE(DependentGenericParamType)
NODE(DependentGenericSameTypeRequirement)
NODE(DependentGenericLayoutRequirement)
NODE(DependentGenericSignature)
NODE(DependentGenericType)
NODE(DependentMemberType)
NODE(DependentPseudogenericSignature)
NODE(DependentProtocolConformanceRoot)
NODE(DependentProtocolConformanceInherited)
NODE(DependentProtocolConformanceAssociated)
CONTEXT_NODE(Destructor)
CONTEXT_NODE(DidSet)
NODE(Directness)
NODE(DynamicAttribute)
NODE(DirectMethodReferenceAttribute)
NODE(DynamicSelf)
NODE(DynamicallyReplaceableFunctionImpl)
NODE(DynamicallyReplaceableFunctionKey)
NODE(DynamicallyReplaceableFunctionVar)
CONTEXT_NODE(Enum)
NODE(EnumCase)
NODE(ErrorType)
NODE(EscapingAutoClosureType)
NODE(NoEscapeFunctionType)
NODE(ExistentialMetatype)
CONTEXT_NODE(ExplicitClosure)
CONTEXT_NODE(Extension)
NODE(FieldOffset)
NODE(FullTypeMetadata)
CONTEXT_NODE(Function)
NODE(FunctionSignatureSpecialization)
NODE(FunctionSignatureSpecializationParam)
NODE(FunctionSignatureSpecializationParamKind)
NODE(FunctionSignatureSpecializationParamPayload)
NODE(FunctionType)
NODE(GenericPartialSpecialization)
NODE(GenericPartialSpecializationNotReAbstracted)
NODE(GenericProtocolWitnessTable)
NODE(GenericProtocolWitnessTableInstantiationFunction)
NODE(ResilientProtocolWitnessTable)
NODE(GenericSpecialization)
NODE(GenericSpecializationNotReAbstracted)
NODE(GenericSpecializationParam)
NODE(InlinedGenericFunction)
NODE(GenericTypeMetadataPattern)
CONTEXT_NODE(Getter)
NODE(Global)
CONTEXT_NODE(GlobalGetter)
NODE(Identifier)
NODE(Index)
CONTEXT_NODE(IVarInitializer)
CONTEXT_NODE(IVarDestroyer)
NODE(ImplEscaping)
NODE(ImplConvention)
NODE(ImplFunctionAttribute)
NODE(ImplFunctionType)
CONTEXT_NODE(ImplicitClosure)
NODE(ImplParameter)
NODE(ImplResult)
NODE(ImplErrorResult)
NODE(InOut)
NODE(InfixOperator)
CONTEXT_NODE(Initializer)
NODE(KeyPathGetterThunkHelper)
NODE(KeyPathSetterThunkHelper)
NODE(KeyPathEqualsThunkHelper)
NODE(KeyPathHashThunkHelper)
NODE(LazyProtocolWitnessTableAccessor)
NODE(LazyProtocolWitnessTableCacheVariable)
NODE(LocalDeclName)
CONTEXT_NODE(MaterializeForSet)
NODE(MergedFunction)
NODE(Metatype)
NODE(MetatypeRepresentation)
NODE(Metaclass)
NODE(MethodLookupFunction)
NODE(ObjCMetadataUpdateFunction)
CONTEXT_NODE(ModifyAccessor)
CONTEXT_NODE(Module)
CONTEXT_NODE(NativeOwningAddressor)
CONTEXT_NODE(NativeOwningMutableAddressor)
CONTEXT_NODE(NativePinningAddressor)
CONTEXT_NODE(NativePinningMutableAddressor)
NODE(NominalTypeDescriptor)
NODE(NonObjCAttribute)
NODE(Number)
NODE(ObjCAttribute)
NODE(ObjCBlock)
CONTEXT_NODE(OtherNominalType)
CONTEXT_NODE(OwningAddressor)
CONTEXT_NODE(OwningMutableAddressor)
NODE(PartialApplyForwarder)
NODE(PartialApplyObjCForwarder)
NODE(PostfixOperator)
NODE(PrefixOperator)
NODE(PrivateDeclName)
NODE(PropertyDescriptor)
CONTEXT_NODE(Protocol)
CONTEXT_NODE(ProtocolSymbolicReference)
NODE(ProtocolConformance)
NODE(ProtocolConformanceRefInTypeModule)
NODE(ProtocolConformanceRefInProtocolModule)
NODE(ProtocolConformanceRefInOtherModule)
NODE(ProtocolDescriptor)
NODE(ProtocolConformanceDescriptor)
NODE(ProtocolList)
NODE(ProtocolListWithClass)
NODE(ProtocolListWithAnyObject)
NODE(ProtocolSelfConformanceDescriptor)
NODE(ProtocolSelfConformanceWitness)
NODE(ProtocolSelfConformanceWitnessTable)
NODE(ProtocolWitness)
NODE(ProtocolWitnessTable)
NODE(ProtocolWitnessTableAccessor)
NODE(ProtocolWitnessTablePattern)
NODE(ReabstractionThunk)
NODE(ReabstractionThunkHelper)
CONTEXT_NODE(ReadAccessor)
NODE(RelatedEntityDeclName)
NODE(RetroactiveConformance)
NODE(ReturnType)
NODE(Shared)
NODE(Owned)
NODE(SILBoxType)
NODE(SILBoxTypeWithLayout)
NODE(SILBoxLayout)
NODE(SILBoxMutableField)
NODE(SILBoxImmutableField)
CONTEXT_NODE(Setter)
NODE(SpecializationPassID)
NODE(IsSerialized)
CONTEXT_NODE(Static)
CONTEXT_NODE(Structure)
CONTEXT_NODE(Subscript)
NODE(Suffix)
NODE(ThinFunctionType)
NODE(Tuple)
NODE(TupleElement)
NODE(TupleElementName)
NODE(Type)
CONTEXT_NODE(TypeSymbolicReference)
CONTEXT_NODE(TypeAlias)
NODE(TypeList)
NODE(TypeMangling)
NODE(TypeMetadata)
NODE(TypeMetadataAccessFunction)
NODE(TypeMetadataCompletionFunction)
NODE(TypeMetadataInstantiationCache)
NODE(TypeMetadataInstantiationFunction)
NODE(TypeMetadataSingletonInitializationCache)
NODE(TypeMetadataLazyCache)
NODE(UncurriedFunctionType)
#define REF_STORAGE(Name, ...) NODE(Name)
#include "AMapReferenceStorage.def"
CONTEXT_NODE(UnsafeAddressor)
CONTEXT_NODE(UnsafeMutableAddressor)
NODE(ValueWitness)
NODE(ValueWitnessTable)
CONTEXT_NODE(Variable)
NODE(VTableThunk)
NODE(VTableAttribute) // note: old mangling only
CONTEXT_NODE(WillSet)
NODE(ReflectionMetadataBuiltinDescriptor)
NODE(ReflectionMetadataFieldDescriptor)
NODE(ReflectionMetadataAssocTypeDescriptor)
NODE(ReflectionMetadataSuperclassDescriptor)
NODE(GenericTypeParamDecl)
NODE(CurryThunk)
NODE(DispatchThunk)
NODE(MethodDescriptor)
NODE(ProtocolRequirementsBaseDescriptor)
NODE(AssociatedConformanceDescriptor)
NODE(DefaultAssociatedConformanceAccessor)
NODE(BaseConformanceDescriptor)
NODE(AssociatedTypeDescriptor)
NODE(ThrowsAnnotation)
NODE(EmptyList)
NODE(FirstElementMarker)
NODE(VariadicMarker)
NODE(OutlinedBridgedMethod)
NODE(OutlinedCopy)
NODE(OutlinedConsume)
NODE(OutlinedRetain)
NODE(OutlinedRelease)
NODE(OutlinedInitializeWithTake)
NODE(OutlinedInitializeWithCopy)
NODE(OutlinedAssignWithTake)
NODE(OutlinedAssignWithCopy)
NODE(OutlinedDestroy)
NODE(OutlinedVariable)
NODE(AssocTypePath)
NODE(LabelList)
NODE(ModuleDescriptor)
NODE(ExtensionDescriptor)
NODE(AnonymousDescriptor)
NODE(AssociatedTypeGenericParamRef)
NODE(SugaredOptional)
NODE(SugaredArray)
NODE(SugaredDictionary)
NODE(SugaredParen)
#undef CONTEXT_NODE
#undef NODE
Binary file not shown.
@@ -0,0 +1,197 @@
//===--- AMapReferenceStorage.def - Non-default reference storage ---*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines non-default reference storage kind macros used for
// macro-metaprogramming.
//
//===----------------------------------------------------------------------===//
/// There are two fundamental reference storage types: checked and unchecked.
/// Checked storage types have runtime enforced correctness.
/// Unchecked storage types have no runtime enforced correctness.
///
/// Checked reference storage types are also subcategorized by loadability.
/// * Always loadable: The compiler may move the reference or use registers.
/// * Never loadable: The runtime (etc) tracks the address of the reference.
/// * Sometimes loadable: If the reference is a native object, then it is
/// always loadable. Otherwise fall back to never loadable semantics, a.k.a.
/// "address only".
///
/// Unchecked reference storage types are always loadable.
///
/// The primary macros therefore are:
/// * ALWAYS_LOADABLE_CHECKED_REF_STORAGE
/// * SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
/// * NEVER_LOADABLE_CHECKED_REF_STORAGE
/// * UNCHECKED_REF_STORAGE
///
/// Helper macros include:
/// * CHECKED_REF_STORAGE -- Any checked reference storage type. Specifically
/// "always", "sometimes", and "never" -- but not "unchecked".
/// * LOADABLE_REF_STORAGE -- Any loadable reference storage type. Specifically
/// "always", "sometimes", and "unchecked" -- but not "never".
/// * ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE -- self describing.
/// * NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE -- self describing.
///
/// SUBSYSTEMS NOTES
///
/// In general, reference storage types are barely visible in the user facing
/// type system and therefore AST clients above SIL can get away with
/// just REF_STORAGE, or CHECKED_REF_STORAGE with UNCHECKED_REF_STORAGE.
///
/// When it comes to SIL aware AST clients, loadability matters. The best way
/// to understand how the helper macros are used is to look at SILNodes.def.
/// What follows is a short -- possibly not up to date -- summary:
///
/// UNCHECKED_REF_STORAGE
/// Name##RetainValueInst
/// Name##ReleaseValueInst
/// LOADABLE_REF_STORAGE
/// Ref*ToNameInst
/// Name*ToRefInst
/// NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
/// Load##Name##Inst
/// Store##Name##Inst
/// ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
/// Copy##Name##ValueInst
/// StrongRetain##Name##Inst
/// Name##RetainInst
/// Name##ReleaseInst
///
/// After helper macro expansion:
///
/// UNCHECKED_REF_STORAGE
/// Ref*ToNameInst
/// Name*ToRefInst
/// Name##RetainValueInst
/// Name##ReleaseValueInst
/// ALWAYS_LOADABLE_CHECKED_REF_STORAGE
/// Ref*ToNameInst
/// Name*ToRefInst
/// Copy##Name##ValueInst
/// StrongRetain##Name##Inst
/// Name##RetainInst
/// Name##ReleaseInst
/// SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
/// Ref*ToNameInst
/// Name*ToRefInst
/// Load##Name##Inst
/// Store##Name##Inst
/// Copy##Name##ValueInst
/// StrongRetain##Name##Inst
/// Name##RetainInst
/// Name##ReleaseInst
/// NEVER_LOADABLE_CHECKED_REF_STORAGE
/// Load##Name##Inst
/// Store##Name##Inst
///
/// Finally, a note about IRGen: TypeInfos need to be created per reference
/// storage type, and SOMETIMES_LOADABLE_CHECKED_REF_STORAGE needs *two*
/// TypeInfos to be created. One for the loadable scenario, and one for the
/// address-only scenario.
#ifndef REF_STORAGE
#define REF_STORAGE(Name, name, NAME)
#endif
#ifdef ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#if defined(ALWAYS_LOADABLE_CHECKED_REF_STORAGE) || \
defined(SOMETIMES_LOADABLE_CHECKED_REF_STORAGE)
#error Overlapping meta-programming macros
#endif
#define ALWAYS_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME)
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME)
#endif
#ifdef NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#if defined(NEVER_LOADABLE_CHECKED_REF_STORAGE) || \
defined(SOMETIMES_LOADABLE_CHECKED_REF_STORAGE)
#error Overlapping meta-programming macros
#endif
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME)
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME)
#endif
#ifdef LOADABLE_REF_STORAGE
#if defined(ALWAYS_LOADABLE_CHECKED_REF_STORAGE) || \
defined(SOMETIMES_LOADABLE_CHECKED_REF_STORAGE) || \
defined(UNCHECKED_REF_STORAGE)
#error Overlapping meta-programming macros
#endif
#define ALWAYS_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
LOADABLE_REF_STORAGE(Name, name, NAME)
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
LOADABLE_REF_STORAGE(Name, name, NAME)
#define UNCHECKED_REF_STORAGE(Name, name, NAME) \
LOADABLE_REF_STORAGE(Name, name, NAME)
#endif
#ifdef CHECKED_REF_STORAGE
#if defined(SOMETIMES_LOADABLE_CHECKED_REF_STORAGE) || \
defined(ALWAYS_LOADABLE_CHECKED_REF_STORAGE) || \
defined(NEVER_LOADABLE_CHECKED_REF_STORAGE)
#error Overlapping meta-programming macros
#endif
#define ALWAYS_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
CHECKED_REF_STORAGE(Name, name, NAME)
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
CHECKED_REF_STORAGE(Name, name, NAME)
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
CHECKED_REF_STORAGE(Name, name, NAME)
#endif
#ifndef NEVER_LOADABLE_CHECKED_REF_STORAGE
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
REF_STORAGE(Name, name, NAME)
#endif
#ifndef SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
REF_STORAGE(Name, name, NAME)
#endif
#ifndef ALWAYS_LOADABLE_CHECKED_REF_STORAGE
#define ALWAYS_LOADABLE_CHECKED_REF_STORAGE(Name, name, NAME) \
REF_STORAGE(Name, name, NAME)
#endif
#ifndef UNCHECKED_REF_STORAGE
#define UNCHECKED_REF_STORAGE(Name, name, NAME) \
REF_STORAGE(Name, name, NAME)
#endif
#ifndef REF_STORAGE_RANGE
#define REF_STORAGE_RANGE(First, Last)
#endif
// NOTE: You will need to update ReferenceOwnership in ModuleFormat.h.
//NEVER_LOADABLE_CHECKED_REF_STORAGE(Weak, weak, WEAK)
//SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Unowned, unowned, UNOWNED)
//UNCHECKED_REF_STORAGE(Unmanaged, unmanaged, UNMANAGED)
REF_STORAGE_RANGE(Weak, Unmanaged)
#undef REF_STORAGE
#undef NEVER_LOADABLE_CHECKED_REF_STORAGE
#undef ALWAYS_LOADABLE_CHECKED_REF_STORAGE
#undef SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#undef UNCHECKED_REF_STORAGE
#undef REF_STORAGE_RANGE
#undef ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#undef NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE
#undef LOADABLE_REF_STORAGE
#undef CHECKED_REF_STORAGE
@@ -0,0 +1,68 @@
//===--- AMapStandardTypesMangling - Mangling Metaprogramming ---*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
/// STANDARD_TYPE(KIND, MANGLING, TYPENAME)
/// The 1-character MANGLING for a known TYPENAME of KIND.
STANDARD_TYPE(Structure, A, AutoreleasingUnsafeMutablePointer)
STANDARD_TYPE(Structure, a, Array)
STANDARD_TYPE(Structure, b, Bool)
STANDARD_TYPE(Structure, c, UnicodeScalar)
STANDARD_TYPE(Structure, D, Dictionary)
STANDARD_TYPE(Structure, d, Double)
STANDARD_TYPE(Structure, f, Float)
STANDARD_TYPE(Structure, h, Set)
STANDARD_TYPE(Structure, I, DefaultIndices)
STANDARD_TYPE(Structure, i, Int)
STANDARD_TYPE(Structure, J, Character)
STANDARD_TYPE(Structure, N, ClosedRange)
STANDARD_TYPE(Structure, n, Range)
STANDARD_TYPE(Structure, O, ObjectIdentifier)
STANDARD_TYPE(Structure, P, UnsafePointer)
STANDARD_TYPE(Structure, p, UnsafeMutablePointer)
STANDARD_TYPE(Structure, R, UnsafeBufferPointer)
STANDARD_TYPE(Structure, r, UnsafeMutableBufferPointer)
STANDARD_TYPE(Structure, S, String)
STANDARD_TYPE(Structure, s, Substring)
STANDARD_TYPE(Structure, u, UInt)
STANDARD_TYPE(Structure, V, UnsafeRawPointer)
STANDARD_TYPE(Structure, v, UnsafeMutableRawPointer)
STANDARD_TYPE(Structure, W, UnsafeRawBufferPointer)
STANDARD_TYPE(Structure, w, UnsafeMutableRawBufferPointer)
STANDARD_TYPE(Enum, q, Optional)
STANDARD_TYPE(Protocol, B, BinaryFloatingPoint)
STANDARD_TYPE(Protocol, E, Encodable)
STANDARD_TYPE(Protocol, e, Decodable)
STANDARD_TYPE(Protocol, F, FloatingPoint)
STANDARD_TYPE(Protocol, G, RandomNumberGenerator)
STANDARD_TYPE(Protocol, H, Hashable)
STANDARD_TYPE(Protocol, j, Numeric)
STANDARD_TYPE(Protocol, K, BidirectionalCollection)
STANDARD_TYPE(Protocol, k, RandomAccessCollection)
STANDARD_TYPE(Protocol, L, Comparable)
STANDARD_TYPE(Protocol, l, Collection)
STANDARD_TYPE(Protocol, M, MutableCollection)
STANDARD_TYPE(Protocol, m, RangeReplaceableCollection)
STANDARD_TYPE(Protocol, Q, Equatable)
STANDARD_TYPE(Protocol, T, Sequence)
STANDARD_TYPE(Protocol, t, IteratorProtocol)
STANDARD_TYPE(Protocol, U, UnsignedInteger)
STANDARD_TYPE(Protocol, X, RangeExpression)
STANDARD_TYPE(Protocol, x, Strideable)
STANDARD_TYPE(Protocol, Y, RawRepresentable)
STANDARD_TYPE(Protocol, y, StringProtocol)
STANDARD_TYPE(Protocol, Z, SignedInteger)
STANDARD_TYPE(Protocol, z, BinaryInteger)
#undef STANDARD_TYPE
@@ -0,0 +1,74 @@
//
// AMapFoundationConst.h
// AMapFoundationKit
//
// Created by JL on 2019/7/22.
// Copyright © 2019 Amap.com. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NSInteger AMapFoundationNSErrorCode;
//ErrorDomain:文件不存在 错误码:-555555
extern NSErrorDomain const AMapFoundationNSErrorFileDonotExist;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorFileDonotExistCode;
//ErrorDomain:文件路径不合法 错误码:-555556
extern NSErrorDomain const AMapFoundationNSErrorFilePathInvaild;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorFilePathInvaildCode;
//ErrorDomain:指定类型的日志文件不存在 错误码:-555557
extern NSErrorDomain const AMapFoundationNSErrorTypeLogDonotExist;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorTypeLogDonotExistCode;
//ErrorDomain:待上传的数据为空(可能是组装/压缩时出错) 错误码:-555558
extern NSErrorDomain const AMapFoundationNSErrorUploadDataIsEmpty;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorUploadDataIsEmptyCode;
//ErrorDomain:参数错误 错误码:-444444
extern NSErrorDomain const AMapFoundationNSErrorParametersInvalid;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorParametersInvalidCode;
extern NSErrorDomain const AMapFoundationNSErrorCloudConfigDisable;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorCloudConfigDisableCode;
extern NSErrorDomain const AMapFoundationNSErrorNetworkUnusable;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorNetworkUnusableCode;
extern NSErrorDomain const AMapFoundationNSErrorCurrentworkIsRunning;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorCurrentworkIsRunningCode;
extern NSErrorDomain const AMapFoundationNSErrorCurrentUploadSizeHaveExcess;
extern AMapFoundationNSErrorCode const AMapFoundationNSErrorCurrentUploadSizeHaveExcessCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyShowUnknow;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyShowUnknowCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyShowNoShow;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyShowNoShowCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyInfoUnknow;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyInfoUnknowCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyInfoNotContain;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyInfoNotContainCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyAgreeUnknow;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyAgreeUnknowCode;
extern NSErrorDomain const AMapFoundationErrorPrivacyAgreeNotAgreee;
extern AMapFoundationNSErrorCode const AMapFoundationErrorPrivacyAgreeNotAgreeeCode;
extern NSErrorDomain const AMapFoundationErrorBikeLicenseDontAuth;
extern AMapFoundationNSErrorCode const AMapFoundationErrorBikeLicenseDontAuthCode;
extern NSErrorDomain const AMapFoundationErrorInvaildUserKey;
extern AMapFoundationNSErrorCode const AMapFoundationErrorInvaildUserKeyCode;
NS_ASSUME_NONNULL_END
@@ -0,0 +1,20 @@
//
// AMapFoundationKit.h
// AMapFoundationKit
//
// Created by xiaoming han on 15/10/28.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <AMapFoundationKit/AMapFoundationVersion.h>
#import <AMapFoundationKit/AMapServices.h>
#import <AMapFoundationKit/AMapURLSearchConfig.h>
#import <AMapFoundationKit/AMapURLSearchType.h>
#import <AMapFoundationKit/AMapURLSearch.h>
#import <AMapFoundationKit/AMapFoundationConst.h>
#import <AMapFoundationKit/AMapUtility.h>
#if __has_include(<AMapFoundationKit/AMapLicenseManager.h>)
#import <AMapFoundationKit/AMapLicenseManager.h>
#endif
@@ -0,0 +1,19 @@
//
// AMapFoundationVersion.h
// AMapFoundation
//
// Created by xiaoming han on 15/10/26.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#ifndef AMapFoundationVersion_h
#define AMapFoundationVersion_h
#define AMapFoundationVersionNumber 10900
FOUNDATION_EXTERN NSString * const AMapFoundationVersion;
FOUNDATION_EXTERN NSString * const AMapFoundationName;
#endif /* AMapFoundationVersion_h */
@@ -0,0 +1,175 @@
//
// AMapSearchServices.h
// AMapSearchKit
//
// Created by xiaoming han on 15/6/18.
// Copyright (c) 2015年 xiaoming han. All rights reserved.
//
#import <Foundation/Foundation.h>
//语言类型 language type
typedef NS_ENUM(int, AMapRegionLanguageType)
{
/// 简体中文 (Simplified Chinese)
AMapRegionLanguageTypeZhHans = 0,
/// 香港繁体中文 (Traditional Chinese - Hong Kong)
AMapRegionLanguageTypeZhHantHk,
/// 英文 (English)
AMapRegionLanguageTypeEn,
/// 西班牙语 (Spanish)
AMapRegionLanguageTypeEs,
/// 葡萄牙语 (Portuguese)
AMapRegionLanguageTypePt,
/// 法语 (French)
AMapRegionLanguageTypeFr,
/// 德语 (German)
AMapRegionLanguageTypeDe,
/// 泰语 (Thai)
AMapRegionLanguageTypeTh,
/// 日语 (Japanese)
AMapRegionLanguageTypeJa,
/// 韩语 (Korean)
AMapRegionLanguageTypeKo,
/// 阿拉伯语 (Arabic)
AMapRegionLanguageTypeAr,
/// 土耳其语 (Turkish)
AMapRegionLanguageTypeTr,
/// 希伯来语 (Hebrew)
AMapRegionLanguageTypeHe,
/// 意大利语 (Italian)
AMapRegionLanguageTypeIt,
/// 俄语 (Russian)
AMapRegionLanguageTypeRu,
/// 马来语 (Malay)
AMapRegionLanguageTypeMs,
/// 印尼语 (Indonesian)
AMapRegionLanguageTypeId,
/// 越南语 (Vietnamese)
AMapRegionLanguageTypeVi,
/// 波兰语 (Polish)
AMapRegionLanguageTypePl,
/// 捷克语 (Czech)
AMapRegionLanguageTypeCs,
/// 乌克兰语 (Ukrainian)
AMapRegionLanguageTypeUk,
/// 阿塞拜疆语 (Azerbaijani)
AMapRegionLanguageTypeAz,
/// 最大值标识 (Max Value Marker)
AMapRegionLanguageTypeMax
};
/**
* 是否为海外用户...海外用户,SDK内部会屏蔽一些操作 默认为NO.
* @warning AMapServices初始化之前,设置才能生效
*/
extern BOOL _amapLocationOverseas;
// 显示隐私弹窗状态 -1: unknow , 0 : 未显示 1 已显示
typedef NS_ENUM(NSInteger, AMapPrivacyShowStatus)
{
AMapPrivacyShowStatusUnknow = -1,
AMapPrivacyShowStatusNotShow = 0,
AMapPrivacyShowStatusDidShow = 1,
};
// RTL状态 0: 未设置,跟随全局 , 1 : 关闭 , 2 : 强制开启
typedef NS_ENUM(NSInteger, AMapAttributeRTLState)
{
AMapAttributeRTLStateDefault = 0,
AMapAttributeRTLStateDisabled,
AMapAttributeRTLStateEnabled
};
// 集成SDK隐私信息状态 -1: unknow , 0 : 未集成 1 已集成
typedef NS_ENUM(NSInteger, AMapPrivacyInfoStatus)
{
AMapPrivacyInfoStatusUnknow = -1,
AMapPrivacyInfoStatusNotContain = 0,
AMapPrivacyInfoStatusDidContain = 1,
};
// 用户同意隐私状态 -1: unknow , 0 : 未同意 1 已同意
typedef NS_ENUM(NSInteger, AMapPrivacyAgreeStatus)
{
AMapPrivacyAgreeStatusUnknow = -1,
AMapPrivacyAgreeStatusNotAgree = 0,
AMapPrivacyAgreeStatusDidAgree = 1,
};
///高德SDK服务类
@interface AMapServices : NSObject
/**
* @brief 获取单例
*/
+ (AMapServices *)sharedServices;
///语言类型属性
///language type property
@property (nonatomic, assign) AMapRegionLanguageType regionLanguageType;
///国家代码属性
///country code property
@property (nonatomic, copy) NSString *countryCode;
///APIkey。设置key,需要在高德官网控制台绑定对应的bundleid。
@property (nonatomic, copy) NSString *apiKey;
///是否开启HTTPS,从1.3.3版本开始默认为YES。
@property (nonatomic, assign) BOOL enableHTTPS;
///是否启用崩溃日志上传。默认为YES, 只有在真机上设置有效。\n开启崩溃日志上传有助于我们更好的了解SDK的状况,可以帮助我们持续优化和改进SDK。需要注意的是,SDK内部是通过设置NSUncaughtExceptionHandler来捕获异常的,如果您的APP中使用了其他收集崩溃日志的SDK,或者自己有设置NSUncaughtExceptionHandler的话,请保证 AMapServices 的初始化是在其他设置NSUncaughtExceptionHandler操作之后进行的,我们的handler会再处理完异常后调用前一次设置的handler,保证之前设置的handler会被执行。
@property (nonatomic, assign) BOOL crashReportEnabled __attribute__((deprecated("从v1.5.7开始废弃,调用无任何作用")));
///设备标识,取自idfv。用于排查问题时提供。
@property (nonatomic, readonly) NSString *identifier;
///用户是否同意数据用于安全保障。默认为YES。since 1.8.7
///Whether the user agrees to use data for security assurance. Default: YES. Since 1.8.7
@property (nonatomic, assign) BOOL securityAgree;
///用户是否同意数据用于统计分析。默认为YES。since 1.8.7
///Whether the user agrees to use data for statistical analysis. Default: YES. Since 1.8.7
@property (nonatomic, assign) BOOL analysisAgree;
///当前位置经度。since 1.8.7
///Current location longitude. Since 1.8.7
@property (nonatomic, assign) double longitude;
///当前位置纬度。since 1.8.7
///Current location latitude. Since 1.8.7
@property (nonatomic, assign) double latitude;
///是否启用从右向左(RTL)布局,默认为AMapAttributeRTLStateDefault
///Whether to enable right-to-left (RTL) layout, default is AMapAttributeRTLStateDefault
@property (nonatomic, assign) AMapAttributeRTLState enableRTLLayout;
///获取regionLanguageType对应的anguageCode
- (NSString *)getRegionLanguageCode;
@end
@@ -0,0 +1,41 @@
//
// AMapURLSearch.h
// AMapFoundation
//
// Created by xiaoming han on 15/10/28.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AMapURLSearchConfig.h"
///调起高德地图URL进行搜索,若是调起失败,可使用`+ (void)getLatestAMapApp;`方法获取最新版高德地图app.
@interface AMapURLSearch : NSObject
/**
* @brief 打开高德地图AppStore页面
*/
+ (void)getLatestAMapApp;
/**
* @brief 调起高德地图app驾车导航.
* @param config 配置参数.
* @return 是否成功.若为YES则成功调起,若为NO则无法调起.
*/
+ (BOOL)openAMapNavigation:(AMapNaviConfig *)config;
/**
* @brief 调起高德地图app进行路径规划.
* @param config 配置参数.
* @return 是否成功.
*/
+ (BOOL)openAMapRouteSearch:(AMapRouteConfig *)config;
/**
* @brief 调起高德地图app进行POI搜索.
* @param config 配置参数.
* @return 是否成功.
*/
+ (BOOL)openAMapPOISearch:(AMapPOIConfig *)config;
@end
@@ -0,0 +1,79 @@
//
// MAMapURLSearchConfig.h
// MAMapKitNew
//
// Created by xiaoming han on 15/5/25.
// Copyright (c) 2015年 xiaoming han. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "AMapURLSearchType.h"
///导航配置信息
@interface AMapNaviConfig : NSObject
///应用返回的Scheme
@property (nonatomic, copy) NSString *appScheme;
///应用名称
@property (nonatomic, copy) NSString *appName;
///终点
@property (nonatomic, assign) CLLocationCoordinate2D destination;
///导航策略
@property (nonatomic, assign) AMapDrivingStrategy strategy;
@end
#pragma mark -
///路径搜索配置信息
@interface AMapRouteConfig : NSObject
///应用返回的Scheme
@property (nonatomic, copy) NSString *appScheme;
///应用名称
@property (nonatomic, copy) NSString *appName;
///起点坐标
@property (nonatomic, assign) CLLocationCoordinate2D startCoordinate;
///终点坐标
@property (nonatomic, assign) CLLocationCoordinate2D destinationCoordinate;
///驾车策略
@property (nonatomic, assign) AMapDrivingStrategy drivingStrategy;
///公交策略
@property (nonatomic, assign) AMapTransitStrategy transitStrategy;
///路径规划类型
@property (nonatomic, assign) AMapRouteSearchType routeType;
@end
#pragma mark -
///POI搜索配置信息
@interface AMapPOIConfig : NSObject
///应用返回的Scheme
@property (nonatomic, copy) NSString *appScheme;
///应用名称
@property (nonatomic, copy) NSString *appName;
///搜索关键字
@property (nonatomic, copy) NSString *keywords;
///左上角坐标
@property (nonatomic, assign) CLLocationCoordinate2D leftTopCoordinate;
///右下角坐标
@property (nonatomic, assign) CLLocationCoordinate2D rightBottomCoordinate;
@end
@@ -0,0 +1,44 @@
//
// MAMapURLSearchType.h
// MAMapKitNew
//
// Created by xiaoming han on 15/5/25.
// Copyright (c) 2015年 xiaoming han. All rights reserved.
//
///驾车策略
typedef NS_ENUM(NSInteger, AMapDrivingStrategy)
{
AMapDrivingStrategyFastest = 0, ///<速度最快
AMapDrivingStrategyMinFare = 1, ///<避免收费
AMapDrivingStrategyShortest = 2, ///<距离最短
AMapDrivingStrategyNoHighways = 3, ///<不走高速
AMapDrivingStrategyAvoidCongestion = 4, ///<躲避拥堵
AMapDrivingStrategyAvoidHighwaysAndFare = 5, ///<不走高速且避免收费
AMapDrivingStrategyAvoidHighwaysAndCongestion = 6, ///<不走高速且躲避拥堵
AMapDrivingStrategyAvoidFareAndCongestion = 7, ///<躲避收费和拥堵
AMapDrivingStrategyAvoidHighwaysAndFareAndCongestion = 8 ///<不走高速躲避收费和拥堵
};
///公交策略
typedef NS_ENUM(NSInteger, AMapTransitStrategy)
{
AMapTransitStrategyFastest = 0,///<最快捷
AMapTransitStrategyMinFare = 1,///<最经济
AMapTransitStrategyMinTransfer = 2,///<最少换乘
AMapTransitStrategyMinWalk = 3,///<最少步行
AMapTransitStrategyMostComfortable = 4,///<最舒适
AMapTransitStrategyAvoidSubway = 5,///<不乘地铁
};
///路径规划类型
typedef NS_ENUM(NSInteger, AMapRouteSearchType)
{
AMapRouteSearchTypeDriving = 0, ///<驾车
AMapRouteSearchTypeTransit = 1, ///<公交
AMapRouteSearchTypeWalking = 2, ///<步行
};
@@ -0,0 +1,50 @@
//
// AMapUtility.h
// AMapFoundation
//
// Created by xiaoming han on 15/10/27.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
//工具方法
/**
* @brief 如果字符串为nil则返回空字符串
*/
FOUNDATION_STATIC_INLINE NSString * AMapEmptyStringIfNil(NSString *s)
{
return s ? s : @"";
}
///坐标类型枚举
typedef NS_ENUM(NSInteger, AMapCoordinateType)
{
AMapCoordinateTypeAMap = -1, ///<AMap
AMapCoordinateTypeBaidu = 0, ///<Baidu
AMapCoordinateTypeMapBar, ///<MapBar
AMapCoordinateTypeMapABC, ///<MapABC
AMapCoordinateTypeSoSoMap, ///<SoSoMap
AMapCoordinateTypeAliYun, ///<AliYun
AMapCoordinateTypeGoogle, ///<Google
AMapCoordinateTypeGPS, ///<GPS
};
/**
* @brief 转换目标经纬度为高德坐标系,不在枚举范围内的经纬度将直接返回。
* @param coordinate 待转换的经纬度
* @param type 坐标系类型
* @return 高德坐标系经纬度
*/
FOUNDATION_EXTERN CLLocationCoordinate2D AMapCoordinateConvert(CLLocationCoordinate2D coordinate, AMapCoordinateType type);
/**
* @brief 判断目标经纬度处是否有高德数据。输入参数为高德坐标系。此方法为粗略判断,在边界地区可能会不准确。
* @param coordinate 待判断的目标经纬度
* @return 布尔值。YES:有数据,NO:没数据
*/
FOUNDATION_EXTERN BOOL AMapDataAvailableForCoordinate(CLLocationCoordinate2D coordinate);
Binary file not shown.
@@ -0,0 +1,6 @@
framework module AMapFoundationKit {
umbrella header "AMapFoundationKit.h"
export *
module * { export * }
}
+3
View File
@@ -0,0 +1,3 @@
1.9.0+foundation.1b6fcf5
Overseas: false
Industry: false
Binary file not shown.
@@ -0,0 +1,27 @@
//
// AMapGeoFenceError.h
// AMapLocationKit
//
// Created by eidan on 16/12/15.
// Copyright © 2016年 Amap. All rights reserved.
//
#ifndef AMapGeoFenceError_h
#define AMapGeoFenceError_h
///AMapGeoFence errorDomain
extern NSString * const AMapGeoFenceErrorDomain;
///地理围栏错误码
typedef NS_ENUM(NSInteger, AMapGeoFenceErrorCode) {
AMapGeoFenceErrorUnknown = 1, ///< 未知错误
AMapGeoFenceErrorInvalidParameter = 2, ///< 参数错误
AMapGeoFenceErrorFailureConnection = 3, ///< 网络连接异常
AMapGeoFenceErrorFailureAuth = 4, ///< 鉴权失败
AMapGeoFenceErrorNoValidFence = 5, ///< 无可用围栏
AMapGeoFenceErroFailureLocating = 6, ///< 定位错误
AMapGeoFenceErroFailureFullAccuracyLocating = 7, ///< 精确定位错误
};
#endif /* AMapGeoFenceError_h */
@@ -0,0 +1,234 @@
//
// AMapGeoFenceManager.h
// AMapLocationKit
//
// Created by hanxiaoming on 16/12/5.
// Copyright © 2016年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AMapGeoFenceRegionObj.h"
// 以下类涉及的坐标需要使用高德坐标系坐标(GCJ02)
@protocol AMapGeoFenceManagerDelegate;
///地理围栏监听状态类型
typedef NS_OPTIONS(NSUInteger, AMapGeoFenceActiveAction)
{
AMapGeoFenceActiveActionNone = 0, ///< 不进行监听
AMapGeoFenceActiveActionInside = 1 << 0, ///< 在范围内
AMapGeoFenceActiveActionOutside = 1 << 1, ///< 在范围外
AMapGeoFenceActiveActionStayed = 1 << 2, ///< 停留(在范围内超过10分钟)
};
///地理围栏任务状态类型
typedef NS_OPTIONS(NSUInteger, AMapGeoFenceRegionActiveStatus)
{
AMapGeoFenceRegionActiveUNMonitor = 0, ///< 未注册
AMapGeoFenceRegionActiveMonitoring = 1 << 0, ///< 正在监控
AMapGeoFenceRegionActivePaused = 1 << 1, ///< 暂停监控
};
///地理围栏管理类(since 2.3.0
@interface AMapGeoFenceManager : NSObject
///实现了 AMapGeoFenceManagerDelegate 协议的类指针。
@property (nonatomic, weak) id<AMapGeoFenceManagerDelegate> delegate;
///需要进行通知的行为,默认为AMapGeoFenceActiveActionInside。
@property (nonatomic, assign) AMapGeoFenceActiveAction activeAction;
///指定定位是否会被系统自动暂停。默认为NO。
@property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
///检测是否存在虚拟定位风险,默认为NO,即不检测。 \n如果设置为YES,检测到风险后,会通过amapGeoFenceManager:didGeoFencesStatusChangedForRegion:customID:error: 的error给出风险提示,error的格式为error.domain==AMapGeoFenceErrorDomain; error.code==AMapGeoFenceErroFailureLocating;
@property (nonatomic, assign) BOOL detectRiskOfFakeLocation;
/**
* @brief 添加一个圆形围栏
* @param center 围栏的中心点经纬度坐标
* @param radius 围栏的半径,单位:米,要求大于0
* @param customID 用户自定义ID,可选,SDK原值返回
*/
- (void)addCircleRegionForMonitoringWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius customID:(NSString *)customID;
/**
* @brief 根据经纬度坐标数据添加一个闭合的多边形围栏,点与点之间按顺序尾部相连, 第一个点与最后一个点相连
* @param coordinates 经纬度坐标点数据,coordinates对应的内存会拷贝,调用者负责该内存的释放
* @param count 经纬度坐标点的个数,不可小于3个
* @param customID 用户自定义ID,可选,SDK原值返回
*/
- (void)addPolygonRegionForMonitoringWithCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSInteger)count customID:(NSString *)customID;
/**
* @brief 根据要查询的关键字,类型,城市等信息,添加一个或者多个POI地理围栏
* @param keyword 要查询的关键字,多个关键字用“|”分割,必填,keyword和type两者至少必选其一
* @param type 要查询的POI类型,多个类型用“|”分割,必填,keyword和type两者至少必选其一,具体分类编码和规则详见: http://lbs.amap.com/api/webservice/guide/api/search/#text
* @param city 要查询的城市
* @param size 要查询的数据的条数,(0,25],传入<=0的值为10,传入大于25的值为25,默认10
* @param customID 用户自定义ID,可选,SDK原值返回
*/
- (void)addKeywordPOIRegionForMonitoringWithKeyword:(NSString *)keyword POIType:(NSString *)type city:(NSString *)city size:(NSInteger)size customID:(NSString *)customID;
/**
* @brief 根据要查询的点的经纬度,搜索半径等信息,添加一个或者多个POI围栏
* @param locationPoint 点的经纬度坐标,必填
* @param aroundRadius 查询半径,单位:米,(0,50000],超出范围取3000,默认3000
* @param keyword 要查询的关键字,多个关键字用“|”分割,可选
* @param type 要查询的POI类型,多个类型用“|”分割,可选
* @param size 要查询的数据的条数,(0,25],传入<=0的值为10,传入大于25的值为25,默认10
* @param customID 用户自定义ID,可选,SDK原值返回
*/
- (void)addAroundPOIRegionForMonitoringWithLocationPoint:(CLLocationCoordinate2D)locationPoint aroundRadius:(NSInteger)aroundRadius keyword:(NSString *)keyword POIType:(NSString *)type size:(NSInteger)size customID:(NSString *)customID;
/**
* @brief 根据要查询的行政区域关键字,添加一个或者多个行政区域围栏
* @param districtName 行政区域关键字,必填,只支持单个关键词语:行政区名称、citycode、adcode,规则详见: http://lbs.amap.com/api/webservice/guide/api/district/#district
* @param customID 用户自定义ID,可选,SDK原值返回
*/
- (void)addDistrictRegionForMonitoringWithDistrictName:(NSString *)districtName customID:(NSString *)customID;
/**
* @brief 获取指定围栏的运行状态
* @param region 要获取运行状态的围栏
* @return 返回指定围栏的运行状态
*/
- (AMapGeoFenceRegionActiveStatus)statusWithGeoFenceRegion:(AMapGeoFenceRegion *)region;
/**
* @brief 根据customID获得所有已经注册的围栏,如果customID传nil,则返回全部已注册围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 获得的围栏构成的数组,如果没有结果,返回nil
*/
- (NSArray *)geoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 根据customID获得所有正在监控的围栏,如果customID传nil,则返回全部正在监控的围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 获得的围栏构成的数组,如果没有结果,返回nil
*/
- (NSArray *)monitoringGeoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 根据customID获得所有已经暂停的围栏,如果customID传nil,则返回全部已经暂停的围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 获得的围栏构成的数组,如果没有结果,返回nil
*/
- (NSArray *)pausedGeoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 暂停指定customID的围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 返回被暂停围栏的数组,如果没有围栏被暂停,返回nil
*/
- (NSArray *)pauseGeoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 暂停指定围栏
* @param region 要暂停监控的围栏
* @return 返回指定围栏是否被暂停,如果指定围栏没有注册,则返回NO
*/
- (BOOL)pauseTheGeoFenceRegion:(AMapGeoFenceRegion *)region;
/**
* @brief 根据customID开始监控已经暂停的围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 返回开始监控的围栏构成的数组
*/
- (NSArray *)startGeoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 开始监控指定围栏
* @param region 要开始监控的围栏
* @return 返回指定围栏是否开始监控,如果指定围栏没有注册,则返回NO
*/
- (BOOL)startTheGeoFenceRegion:(AMapGeoFenceRegion *)region;
/**
* @brief 移除指定围栏
* @param region 要停止监控的围栏
*/
- (void)removeTheGeoFenceRegion:(AMapGeoFenceRegion *)region;
/**
* @brief 移除指定customID的围栏
* @param customID 用户执行添加围栏函数时传入的customID
*/
- (void)removeGeoFenceRegionsWithCustomID:(NSString *)customID;
/**
* @brief 移除所有围栏
*/
- (void)removeAllGeoFenceRegions;
@end
///地理围栏代理协议(since 2.3.0),该协议定义了获取地理围栏相关回调方法,包括添加、状态改变等。
@protocol AMapGeoFenceManagerDelegate <NSObject>
@required
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
/**
* @brief iOS14及以上版本使用地理围栏功能,需要在plist中配置NSLocationTemporaryUsageDescriptionDictionary字典描述,且添加自定义Key描述地理围栏的使用场景,此描述会在申请临时精确定位权限的弹窗中展示。该回调触发条件:拥有定位权限,但是没有获得精确定位权限的情况下,会触发该回调。此方法实现调用申请临时精确定位权限API即可:
* [locationManager requestTemporaryFullAccuracyAuthorizationWithPurposeKey:@"PurposeKey" completion:^(NSError *error){
* if(completion){
* completion(error);
* }
* }]; (必须调用,不然无法正常获取临时精确定位权限)
* @param manager 地理围栏管理类。
* @param locationManager 需要申请临时精确定位权限的locationManager。
* @param completion 临时精确定位权限API回调结果。直接返回系统error即可
* @since 2.6.7
*/
- (void)amapLocationManager:(AMapGeoFenceManager *)manager doRequireTemporaryFullAccuracyAuth:(CLLocationManager*)locationManager completion:(void(^)(NSError *error))completion;
#endif
@optional
/**
* @brief 当plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription,并且[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined,会调用代理的此方法。
此方法实现申请后台权限API即可:[locationManager requestAlwaysAuthorization](必须调用,不然无法正常获取定位权限)
* @param manager 地理围栏管理类。
* @param locationManager 需要申请后台定位权限的locationManager。
* @since 2.6.2
*/
- (void)amapGeoFenceManager:(AMapGeoFenceManager *)manager doRequireLocationAuth:(CLLocationManager*)locationManager;
/**
* @brief 添加地理围栏完成后的回调,成功与失败都会调用
* @param manager 地理围栏管理类
* @param regions 成功添加的一个或多个地理围栏构成的数组
* @param customID 用户执行添加围栏函数时传入的customID
* @param error 添加失败的错误信息
*/
- (void)amapGeoFenceManager:(AMapGeoFenceManager *)manager didAddRegionForMonitoringFinished:(NSArray <AMapGeoFenceRegion *> *)regions customID:(NSString *)customID error:(NSError *)error;
/**
* @brief 地理围栏状态改变时回调,当围栏状态的值发生改变,定位失败都会调用
* @param manager 地理围栏管理类
* @param region 状态改变的地理围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @param error 错误信息,如定位相关的错误
*/
- (void)amapGeoFenceManager:(AMapGeoFenceManager *)manager didGeoFencesStatusChangedForRegion:(AMapGeoFenceRegion *)region customID:(NSString *)customID error:(NSError *)error;
@end
@@ -0,0 +1,120 @@
//
// AMapGeoFenceRegionObj.h
// AMapLocationKit
//
// Created by hanxiaoming on 16/12/5.
// Copyright © 2016年 Amap. All rights reserved.
//
#import "AMapLocationCommonObj.h"
///AMapGeoFence Region State
typedef NS_ENUM(NSInteger, AMapGeoFenceRegionStatus)
{
AMapGeoFenceRegionStatusUnknown = 0, ///< 未知
AMapGeoFenceRegionStatusInside = 1, ///< 在范围内
AMapGeoFenceRegionStatusOutside = 2, ///< 在范围外
AMapGeoFenceRegionStatusStayed = 3, ///< 停留(在范围内超过10分钟)
};
typedef NS_ENUM(NSInteger, AMapGeoFenceRegionType)
{
AMapGeoFenceRegionTypeCircle = 0, /// 圆形地理围栏
AMapGeoFenceRegionTypePolygon = 1, /// 多边形地理围栏
AMapGeoFenceRegionTypePOI = 2, /// 兴趣点(POI)地理围栏
AMapGeoFenceRegionTypeDistrict = 3, /// 行政区划地理围栏
};
#pragma mark - AMapGeoFenceRegion
///地理围栏基类,不可直接使用。(since 2.3.0
@interface AMapGeoFenceRegion : NSObject<NSCopying>
///AMapGeoFenceRegion的唯一标识符
@property (nonatomic, copy, readonly) NSString *identifier;
///用户自定义ID,可为nil。
@property (nonatomic, copy, readonly) NSString *customID;
///坐标点和围栏的关系,比如用户的位置和围栏的关系
@property (nonatomic, assign) AMapGeoFenceRegionStatus fenceStatus;
///用户自定义ID,可为nil。
@property (nonatomic, assign) AMapGeoFenceRegionType regionType;
///缓存最近获取的定位信息,可能会存在延时,可为nil,会在获取定位时更新
@property (nonatomic, copy) CLLocation *currentLocation;
@end
#pragma mark - AMapLocationCircleRegion
///圆形地理围栏(since 2.3.0
@interface AMapGeoFenceCircleRegion : AMapGeoFenceRegion
///中心点的经纬度坐标
@property (nonatomic, readonly) CLLocationCoordinate2D center;
///半径,单位:米
@property (nonatomic, readonly) CLLocationDistance radius;
@end
#pragma mark -AMapGeoFencePolygonRegion
///多边形地理围栏(since 2.3.0
@interface AMapGeoFencePolygonRegion : AMapGeoFenceRegion
///经纬度坐标点数据
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates;
///经纬度坐标点的个数
@property (nonatomic, readonly) NSInteger count;
@end
#pragma mark -AMapGeoFencePOIRegion
///兴趣点(POI)地理围栏(since 2.3.0
@interface AMapGeoFencePOIRegion : AMapGeoFenceCircleRegion
///POI信息
@property (nonatomic, strong, readonly) AMapLocationPOIItem *POIItem;
@end
#pragma mark -AMapGeoFenceDistrictRegion
///行政区划地理围栏(since 2.3.0
@interface AMapGeoFenceDistrictRegion : AMapGeoFenceRegion
///行政区域信息
@property (nonatomic, strong, readonly) AMapLocationDistrictItem *districtItem;
///行政区域轮廓坐标点,每个行政区可能有多个模块,每个模块的坐标点数组由AMapLocationPoint构成
@property (nonatomic, copy, readonly) NSArray <NSArray<AMapLocationPoint *> *> *polylinePoints;
@end
@@ -0,0 +1,195 @@
//
// AMapLocationCommonObj.h
// AMapLocationKit
//
// Created by AutoNavi on 15/10/22.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIKit.h>
///AMapLocation errorDomain
extern NSString * const AMapLocationErrorDomain;
///AMapLocation errorCode
typedef NS_ENUM(NSInteger, AMapLocationErrorCode)
{
AMapLocationErrorUnknown = 1, ///<未知错误
AMapLocationErrorLocateFailed = 2, ///<定位错误
AMapLocationErrorReGeocodeFailed = 3, ///<逆地理错误
AMapLocationErrorTimeOut = 4, ///<超时
AMapLocationErrorCanceled = 5, ///<取消
AMapLocationErrorCannotFindHost = 6, ///<找不到主机
AMapLocationErrorBadURL = 7, ///<URL异常
AMapLocationErrorNotConnectedToInternet = 8,///<连接异常
AMapLocationErrorCannotConnectToHost = 9, ///<服务器连接失败
AMapLocationErrorRegionMonitoringFailure=10,///<地理围栏错误
AMapLocationErrorRiskOfFakeLocation = 11, ///<存在虚拟定位风险
AMapLocationErrorNoFullAccuracyAuth = 12, ///<精确定位权限异常
};
///AMapLocation Region State
typedef NS_ENUM(NSInteger, AMapLocationRegionState)
{
AMapLocationRegionStateUnknow = 0, ///<未知
AMapLocationRegionStateInside = 1, ///<在范围内
AMapLocationRegionStateOutside = 2, ///<在范围外
};
///AMapLocation Accuracy Mode
typedef NS_ENUM(NSInteger, AMapLocationAccuracyMode) {
AMapLocationFullAndReduceAccuracy = 0, ///<默认模式,该模式下会申请临时精确定位权限,如果用户拒绝,则依然开启定位,回调模糊定位数据;
AMapLocationFullAccuracy, ///<高精度模式,该模式下会申请临时精确定位权限,如果用户拒绝,则回调error;
AMapLocationReduceAccuracy ///<低精度模式,该模式下不会申请临时精确定位权限,根据当前定位权限回调定位数据;
};
///逆地理信息
@interface AMapLocationReGeocode : NSObject<NSCopying,NSCoding>
///格式化地址
@property (nonatomic, copy) NSString *formattedAddress;
///国家
@property (nonatomic, copy) NSString *country;
///省/直辖市
@property (nonatomic, copy) NSString *province;
///市
@property (nonatomic, copy) NSString *city;
///区
@property (nonatomic, copy) NSString *district;
///乡镇
@property (nonatomic, copy) NSString *township __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
///社区
@property (nonatomic, copy) NSString *neighborhood __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
///建筑
@property (nonatomic, copy) NSString *building __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
///城市编码
@property (nonatomic, copy) NSString *citycode;
///区域编码
@property (nonatomic, copy) NSString *adcode;
///街道名称
@property (nonatomic, copy) NSString *street;
///门牌号
@property (nonatomic, copy) NSString *number;
///兴趣点名称
@property (nonatomic, copy) NSString *POIName;
///所属兴趣点名称
@property (nonatomic, copy) NSString *AOIName;
@end
#pragma mark - AMapLocationPoint
///经纬度坐标点对象
@interface AMapLocationPoint : NSObject<NSCopying,NSCoding>
///纬度
@property (nonatomic, assign) CGFloat latitude;
///经度
@property (nonatomic, assign) CGFloat longitude;
/**
* @brief AMapNaviPoint类对象的初始化函数
* @param lat 纬度
* @param lon 经度
* @return AMapNaviPoint类对象id
*/
+ (AMapLocationPoint *)locationWithLatitude:(CGFloat)lat longitude:(CGFloat)lon;
@end
///POI信息
@interface AMapLocationPOIItem : NSObject <NSCopying, NSCoding>
///id
@property (nonatomic, copy) NSString *pId;
///名称
@property (nonatomic, copy) NSString *name;
///类型
@property (nonatomic, copy) NSString *type;
///类型编码
@property (nonatomic, copy) NSString *typeCode;
///地址信息
@property (nonatomic, copy) NSString *address;
///经纬度
@property (nonatomic, strong) AMapLocationPoint *location;
///电话号码
@property (nonatomic, copy) NSString *tel;
///省份
@property (nonatomic, copy) NSString *province;
///城市
@property (nonatomic, copy) NSString *city;
///区
@property (nonatomic, copy) NSString *district;
@end
///行政区域信息
@interface AMapLocationDistrictItem : NSObject <NSCopying, NSCoding>
///城市编码
@property (nonatomic, copy) NSString *cityCode;
///区域编码
@property (nonatomic, copy) NSString *districtCode;
///区名
@property (nonatomic, copy) NSString *district;
///行政区域轮廓坐标点,每个行政区可能有多个模块,每个模块的坐标点数组由AMapLocationPoint构成
@property (nonatomic, copy) NSArray <NSArray<AMapLocationPoint *> *> *polylinePoints;
@end
///AMapLocation CoordinateType
typedef NS_ENUM(NSUInteger, AMapLocationCoordinateType)
{
AMapLocationCoordinateTypeBaidu = 0, ///<Baidu
AMapLocationCoordinateTypeMapBar, ///<MapBar
AMapLocationCoordinateTypeMapABC, ///<MapABC
AMapLocationCoordinateTypeSoSoMap, ///<SoSoMap
AMapLocationCoordinateTypeAliYun, ///<AliYun
AMapLocationCoordinateTypeGoogle, ///<Google
AMapLocationCoordinateTypeGPS, ///<GPS
};
/**
* @brief 转换目标经纬度为高德坐标系
* @param coordinate 待转换的经纬度
* @param type 坐标系类型
* @return 高德坐标系经纬度
*/
FOUNDATION_EXTERN CLLocationCoordinate2D AMapLocationCoordinateConvert(CLLocationCoordinate2D coordinate, AMapLocationCoordinateType type);
/**
* @brief 判断目标经纬度是否在大陆以及港、澳地区。输入参数为高德坐标系。
* @param coordinate 待判断的目标经纬度
* @return 是否在大陆以及港、澳地区
*/
FOUNDATION_EXTERN BOOL AMapLocationDataAvailableForCoordinate(CLLocationCoordinate2D coordinate);
@@ -0,0 +1,17 @@
//
// AMapLocationKit.h
// AMapLocationKit
//
// Created by AutoNavi on 15/10/22.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <AMapLocationKit/AMapLocationVersion.h>
#import <AMapLocationKit/AMapLocationManager.h>
#import <AMapLocationKit/AMapLocationCommonObj.h>
#import <AMapLocationKit/AMapLocationRegionObj.h>
#import <AMapLocationKit/AMapGeoFenceRegionObj.h>
#import <AMapLocationKit/AMapGeoFenceManager.h>
#import <AMapLocationKit/AMapGeoFenceError.h>
@@ -0,0 +1,283 @@
//
// AMapLocationManager.h
// AMapLocationKit
//
// Created by AutoNavi on 15/10/22.
// Copyright © 2015年 Amap. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AMapFoundationKit/AMapServices.h>
#import "AMapLocationCommonObj.h"
#import "AMapLocationRegionObj.h"
/**
* @brief AMapLocatingCompletionBlock 单次定位返回Block
* @param location 定位信息
* @param regeocode 逆地理信息
* @param error 错误信息,参考 AMapLocationErrorCode
*/
typedef void (^AMapLocatingCompletionBlock)(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error);
@protocol AMapLocationManagerDelegate;
#pragma mark - AMapLocationManager
///AMapLocationManager类。初始化之前请设置 AMapServices 中的apikey(例如:[AMapServices sharedServices].apiKey = @"您的key"),否则将无法正常使用服务.
@interface AMapLocationManager : NSObject
///实现了 AMapLocationManagerDelegate 协议的类指针。
@property (nonatomic, weak) id<AMapLocationManagerDelegate> delegate;
///设定定位的最小更新距离。单位米,默认为 kCLDistanceFilterNone,表示只要检测到设备位置发生变化就会更新位置信息。
@property(nonatomic, assign) CLLocationDistance distanceFilter;
///设定期望的定位精度。单位米,默认为 kCLLocationAccuracyBest。定位服务会尽可能去获取满足desiredAccuracy的定位结果,但不保证一定会得到满足期望的结果。
///注意:设置为kCLLocationAccuracyBest或kCLLocationAccuracyBestForNavigation时,单次定位会在达到locationTimeout设定的时间后,将时间内获取到的最高精度的定位结果返回。
///⚠️ 当iOS14及以上版本,模糊定位权限下可能拿不到设置精度的经纬度
@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy;
///指定定位是否会被系统自动暂停。默认为NO。
@property(nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。由于iOS系统限制,需要在定位未开始之前或定位停止之后,修改该属性的值才会有效果。
@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
///指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。
@property(nonatomic, assign) NSInteger locationTimeout;
///指定单次定位逆地理超时时间,默认为5s。最小值是2s。注意单次定位请求前设置。
@property(nonatomic, assign) NSInteger reGeocodeTimeout;
///连续定位是否返回逆地理信息,默认NO。
@property (nonatomic, assign) BOOL locatingWithReGeocode;
// 注意:在使用导航功能前,请通过 [AMapServices sharedServices].regionLanguageType 来设置语言类型 (since 11.2.000)
///逆地址语言类型,默认是AMapRegionLanguageTypeZhHans
//@property (nonatomic, assign) AMapRegionLanguageType reGeocodeLanguage;
///获取被监控的region集合。
@property (nonatomic, readonly, copy) NSSet *monitoredRegions;
///检测是否存在虚拟定位风险,默认为NO,不检测。 \n注意:设置为YES时,单次定位通过 AMapLocatingCompletionBlock 的error给出虚拟定位风险提示;连续定位通过 amapLocationManager:didFailWithError: 方法的error给出虚拟定位风险提示。error格式为 error.domain==AMapLocationErrorDomain; error.code==AMapLocationErrorRiskOfFakeLocation; \n附带的error的详细信息参考 error.localizedDescription 中的描述以及 error.userInfo 中的信息(error.userInfo.AMapLocationRiskyLocateResult 表示有虚拟风险的定位结果; error.userInfo.AMapLocationAccessoryInfo 表示外接辅助设备信息)。
@property (nonatomic, assign) BOOL detectRiskOfFakeLocation;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
/**
* @brief 设置定位数据回调精度模式,默认为AMapLocationAccuracyFullAndReduce。\n
注意:如果定位时未获得定位权限,则首先会调用申请定位权限API,实际定位精度权限取决于用户的权限设置。\n
* ————————————————————————————————————————————————————————————————\n
* | 设置选项 | doRequireTemporaryFullAccuracyAuth | 异常/定位数据回调 |\n
* | AMapLocationFullAndReduceAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则依然开启定位,回调模糊定位 |\n
* | AMapLocationFullAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则不开启定位,回调error |\n
* | AMapLocationReduceAccuracy | 不会触发申请临时精确定位回调 | 根据当前定位精度权限,回调定位数据 |\n
* ————————————————————————————————————————————————————————————————\n
* 当设置AMapLocationFullAndReduceAccuracy时,定位数据回调可通过currentAuthorization判断当前是否是精确定位
* @since 2.6.7
*/
@property (nonatomic, assign) AMapLocationAccuracyMode locationAccuracyMode API_AVAILABLE(ios(14.0));
/**
* @brief 获取当前定位精度权限。
* @since 2.6.7
*/
@property (nonatomic, readonly) CLAccuracyAuthorization currentAuthorization API_AVAILABLE(ios(14.0));
#endif
/**
* @brief 设备是否支持方向识别
* @return YES:设备支持方向识别 ; NO:设备不支持支持方向识别
*/
+ (BOOL)headingAvailable;
/**
* @brief 开始获取设备朝向,如果设备支持方向识别,则会通过代理回调方法
*/
- (void)startUpdatingHeading;
/**
* @brief 停止获取设备朝向
*/
- (void)stopUpdatingHeading;
/**
* @brief 停止设备朝向校准显示
*/
- (void)dismissHeadingCalibrationDisplay;
/**
* @brief 单次定位。如果当前正在连续定位,调用此方法将会失败,返回NO。\n该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy ,将会持续的等待定位信息,直到超时后通过completionBlock返回精度最高的定位信息。\n可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。
* @param withReGeocode 是否带有逆地理信息(获取逆地理信息需要联网)
* @param completionBlock 单次定位完成后的Block
* @return 是否成功添加单次定位Request
*/
- (BOOL)requestLocationWithReGeocode:(BOOL)withReGeocode completionBlock:(AMapLocatingCompletionBlock)completionBlock;
/**
* @brief 开始连续定位。调用此方法会cancel掉所有的单次定位请求。
*/
- (void)startUpdatingLocation;
/**
* @brief 停止连续定位。调用此方法会cancel掉所有的单次定位请求,可以用来取消单次定位。
*/
- (void)stopUpdatingLocation;
/**
* @brief 开始监控指定的region。如果已经存在相同identifier的region,则之前的region将会被移除。对 AMapLocationCircleRegion 类实例,将会优先监控radius小的region。
* @param region 要被监控的范围
*/
- (void)startMonitoringForRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 停止监控指定的region
* @param region 要停止监控的范围
*/
- (void)stopMonitoringForRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 查询一个region的当前状态。查询结果通过amapLocationManager:didDetermineState:forRegion:回调返回
* @param region 要查询的region
*/
- (void)requestStateForRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
#pragma mark - Privacy 隐私合规
/**
* @brief 更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0
* @param showStatus 隐私弹窗状态
* @param containStatus 包含高德SDK隐私协议状态
*/
+ (void)updatePrivacyShow:(AMapPrivacyShowStatus)showStatus privacyInfo:(AMapPrivacyInfoStatus)containStatus;
/**
* @brief 更新用户授权高德SDK隐私协议状态,注意:必须在AMapLocationManager实例化之前调用. since 2.8.0
* @param agreeStatus 用户授权高德SDK隐私协议状态
*/
+ (void)updatePrivacyAgree:(AMapPrivacyAgreeStatus)agreeStatus;
@end
#pragma mark - AMapLocationManagerDelegate
///AMapLocationManagerDelegate 协议定义了发生错误时的错误回调方法,连续定位的回调方法等。
@protocol AMapLocationManagerDelegate <NSObject>
@optional
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
/**
* @brief 触发前提条件:1、plist配置NSLocationTemporaryUsageDescriptionDictionary。2、locationAccuracyMode设置为AMapLocationFullAndReduceAccuracy/AMapLocationFullAccuracy。3、当前用户已授权过定位权限,且为模糊定位权限。触发时机:满足前提条件时,再次发起定位请求会调用代理的此方法。此方法实现调用申请临时精确定位权限API即可:
* [manager requestTemporaryFullAccuracyAuthorizationWithPurposeKey:@"PurposeKey" completion:^(NSError *error){
* if(completion){
* completion(error);
* }
* }]; (必须调用,不然无法正常获取临时精确定位权限)
* @param manager 定位 AMapLocationManager 类。
* @param locationManager 需要申请临时精确定位权限的locationManager。
* @param completion 临时精确定位权限API回调结果,error: 直接返回系统error即可。
* @since 2.6.7
*/
- (void)amapLocationManager:(AMapLocationManager *)manager doRequireTemporaryFullAccuracyAuth:(CLLocationManager*)locationManager completion:(void(^)(NSError *error))completion;
#endif
/**
* @brief 当plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription,并且[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined,会调用代理的此方法。
此方法实现调用申请后台权限API即可:[locationManager requestAlwaysAuthorization] (必须调用,不然无法正常获取定位权限)
* @param manager 定位 AMapLocationManager 类。
* @param locationManager 需要申请后台定位权限的locationManager。
* @since 2.6.2
*/
- (void)amapLocationManager:(AMapLocationManager *)manager doRequireLocationAuth:(CLLocationManager*)locationManager;
/**
* @brief 当定位发生错误时,会调用代理的此方法。
* @param manager 定位 AMapLocationManager 类。
* @param error 返回的错误,参考 CLError 。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error;
/**
* @brief 连续定位回调函数.注意:本方法已被废弃,如果实现了amapLocationManager:didUpdateLocation:reGeocode:方法,则本方法将不会回调。
* @param manager 定位 AMapLocationManager 类。
* @param location 定位结果。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location;
/**
* @brief 连续定位回调函数.注意:如果实现了本方法,则定位信息不会通过amapLocationManager:didUpdateLocation:方法回调。
* @param manager 定位 AMapLocationManager 类。
* @param location 定位结果。
* @param reGeocode 逆地理信息。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode;
/**
* @brief 定位权限状态改变时回调函数。注意:iOS13及之前版本回调
* @param manager 定位 AMapLocationManager 类。
* @param status 定位权限状态。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
/**
* @brief 定位权限状态改变时回调函数。注意:iOS14及之后版本回调
* @param manager 定位 AMapLocationManager 类。
* @param locationManager 定位CLLocationManager类,可通过locationManager.authorizationStatus获取定位权限,通过locationManager.accuracyAuthorization获取定位精度权限
*/
- (void)amapLocationManager:(AMapLocationManager *)manager locationManagerDidChangeAuthorization:(CLLocationManager*)locationManager;
/**
* @brief 是否显示设备朝向校准
* @param manager 定位 AMapLocationManager 类。
* @return 是否显示设备朝向校准
*/
- (BOOL)amapLocationManagerShouldDisplayHeadingCalibration:(AMapLocationManager *)manager;
/**
* @brief 设备方向改变时回调函数
* @param manager 定位 AMapLocationManager 类。
* @param newHeading 设备朝向。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading;
/**
* @brief 开始监控region回调函数
* @param manager 定位 AMapLocationManager 类。
* @param region 开始监控的region。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didStartMonitoringForRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 进入region回调函数
* @param manager 定位 AMapLocationManager 类。
* @param region 进入的region。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didEnterRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 离开region回调函数
* @param manager 定位 AMapLocationManager 类。
* @param region 离开的region。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didExitRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 查询region状态回调函数
* @param manager 定位 AMapLocationManager 类。
* @param state 查询的region的状态。
* @param region 查询的region。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager didDetermineState:(AMapLocationRegionState)state forRegion:(AMapLocationRegion *)region __attribute__((deprecated("请使用AMapGeoFenceManager")));
/**
* @brief 监控region失败回调函数
* @param manager 定位 AMapLocationManager 类。
* @param region 失败的region。
* @param error 错误信息,参考 AMapLocationErrorCode 。
*/
- (void)amapLocationManager:(AMapLocationManager *)manager monitoringDidFailForRegion:(AMapLocationRegion *)region withError:(NSError *)error __attribute__((deprecated("请使用AMapGeoFenceManager")));
@end
@@ -0,0 +1,90 @@
//
// AMapLocationRegionObj.h
// AMapLocationKit
//
// Created by AutoNavi on 15/11/27.
// Copyright © 2015年 Amap. All rights reserved.
//
#import "AMapLocationCommonObj.h"
// 以下类涉及的坐标需要使用高德坐标系坐标(GCJ02)
#pragma mark - AMapLocationRegion
///AMapLocationRegion类,该类提供范围类的基本信息,并无具体实现,不要直接使用。
@interface AMapLocationRegion : NSObject<NSCopying>
///AMapLocationRegion的identifier
@property (nonatomic, copy, readonly) NSString *identifier;
///当进入region范围时是否通知,默认YES
@property (nonatomic, assign) BOOL notifyOnEntry;
///当离开region范围时是否通知,默认YES
@property (nonatomic, assign) BOOL notifyOnExit;
/**
* @brief 初始化方法
* @param identifier 唯一标识符,必填,不可为nil
*/
- (instancetype)initWithIdentifier:(NSString *)identifier;
/**
* @brief 坐标点是否在范围内
* @param coordinate 要判断的坐标点
* @return 是否在范围内
*/
- (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinate;
@end
#pragma mark - AMapLocationCircleRegion
///AMapLocationCircleRegion类,定义一个圆形范围。
@interface AMapLocationCircleRegion : AMapLocationRegion
///中心点的经纬度坐标
@property (nonatomic, readonly) CLLocationCoordinate2D center;
///半径,单位:米
@property (nonatomic, readonly) CLLocationDistance radius;
/**
* @brief 根据中心点和半径生成圆形范围
* @param center 中心点的经纬度坐标
* @param radius 半径,单位:米
* @param identifier 唯一标识符,必填,不可为nil
* @return AMapLocationCircleRegion类实例
*/
- (instancetype)initWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius identifier:(NSString *)identifier;
@end
#pragma mark - AMapLocationPolygonRegion
///AMapLocationCircleRegion类,定义一个闭合多边形范围,点与点之间按顺序尾部相连, 第一个点与最后一个点相连。
@interface AMapLocationPolygonRegion : AMapLocationRegion
///经纬度坐标点数据
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates;
///经纬度坐标点的个数
@property (nonatomic, readonly) NSInteger count;
/**
* @brief 根据经纬度坐标数据生成闭合多边形范围
* @param coordinates 经纬度坐标点数据,coordinates对应的内存会拷贝,调用者负责该内存的释放
* @param count 经纬度坐标点的个数,不可小于3个
* @param identifier 唯一标识符,必填,不可为nil
* @return AMapLocationCircleRegion类实例
*/
- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSInteger)count identifier:(NSString *)identifier;
@end
@@ -0,0 +1,26 @@
//
// AMapLoctionVersion.h
// AMapLocationKit
//
// Created by AutoNavi on 16/1/22.
// Copyright © 2016年 Amap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AMapFoundationKit/AMapFoundationVersion.h>
#ifndef AMapLoctionVersion_h
#define AMapLoctionVersion_h
#define AMapLocationVersionNumber 201200
#define AMapLocationFoundationVersionMinRequired 10900
// 依赖库版本检测
#if AMapFoundationVersionNumber < AMapLocationFoundationVersionMinRequired
#error "The AMapFoundationKit version is less than minimum required, please update! Any questions please to visit http://lbs.amap.com"
#endif
FOUNDATION_EXTERN NSString * const AMapLocationVersion;
FOUNDATION_EXTERN NSString * const AMapLocationName;
#endif /* AMapLoctionVersion_h */
Binary file not shown.
@@ -0,0 +1,6 @@
framework module AMapLocationKit {
umbrella header "AMapLocationKit.h"
export *
module * { export * }
}
+2
View File
@@ -0,0 +1,2 @@
2.12.0+loc.4f55976
isOversea:false
+31
View File
@@ -0,0 +1,31 @@
# AMap 高德定位 SDK
| 项 | 值 |
|---|---|
| AMapFoundationKit | 1.9.0+foundation.1b6fcf5 |
| AMapLocationKit | 2.12.0+loc.4f55976 |
| 来源 | [高德开放平台 iOS 定位 SDK 下载页](https://lbs.amap.com/api/ios-location-sdk/download) |
| 路径 | `Vendor/AMap/AMapFoundationKit.framework` / `Vendor/AMap/AMapLocationKit.framework` |
| 架构 | fatx86_64 + arm64,单 `.framework` 同时支持设备 + 模拟器) |
| 模块名 | `AMapFoundationKit` / `AMapLocationKit` |
| 引入日期 | 2026-06-22 |
## 工程接入步骤(用户在 Xcode 手动)
> ⚠️ 高德官方发布的还是旧式 fat `.framework`(不是 `.xcframework`)。Xcode 26+ 接受 fat `.framework`,但若构建报「Could not find module ... for 'arm64-apple-ios-simulator'」可能要先用 `xcodebuild -create-xcframework` 转封。先按下面流程跑,遇到问题再处理。
1. Project Navigator → 选中 ylgamehall target → General → Frameworks, Libraries, and Embedded Content
2.`+` → Add Other → Add Files → 把 `Vendor/AMap/AMapFoundationKit.framework``AMapLocationKit.framework` 一起加入
3. 两个都设为 **Do Not Embed**(高德 fat `.framework` 是静态库,不能 Embed;Embed 会触发链接器对 `__OBJC` 段重复符号错误)
4. Build Settings → Framework Search Paths 自动会被 Xcode 写入 `$(PROJECT_DIR)/Vendor/AMap`
5. Clean Build Folder 后 BuildProject
接入完毕后,源码内 `#if canImport(AMapLocationKit)` 守卫将激活真实路径。
## 凭证
`docs/SDK-Integration-Guide.md §0` 凭证总表。APIKey 沿用 msext`b0d4a8e3fcbbcc0dd96283b7df6a4494`,与 Bundle ID `com.skyapp.ylgamehall` 绑死)。
## Info.plist 必需
- `NSLocationWhenInUseUsageDescription`:定位权限文案(已由工程接入时统一添加,见 SDK-Integration-Guide §2.2