SwiftAmapLocationPlugin.swift 614 B

1234567891011121314151617
  1. import Flutter
  2. import UIKit
  3. import AMapFoundationKit
  4. public class SwiftAmapLocationPlugin: NSObject, FlutterPlugin {
  5. public static func register(with registrar: FlutterPluginRegistrar) {
  6. if let path = Bundle.main.path(forResource: "Info", ofType: "plist") {
  7. let resourceFileDictionary = NSDictionary(contentsOfFile: path)
  8. if let key = resourceFileDictionary?.object(forKey: "amap_key") {
  9. AMapServices.shared().apiKey = key as? String
  10. }
  11. }
  12. AMapServices.shared().enableHTTPS = true
  13. AmapLocationFactory(withMessenger: registrar.messenger()).register()
  14. }
  15. }