UmengCommonPlugin.swift 849 B

12345678910111213141516171819202122232425
  1. import Flutter
  2. import UIKit
  3. import UM
  4. public class UmengCommonPlugin: NSObject, FlutterPlugin {
  5. public static func register(with registrar: FlutterPluginRegistrar) {
  6. let channel = FlutterMethodChannel(name: "umeng_common", binaryMessenger: registrar.messenger())
  7. let instance = UmengCommonPlugin()
  8. registrar.addMethodCallDelegate(instance, channel: channel)
  9. }
  10. public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
  11. switch call.method {
  12. case "getPlatformVersion":
  13. result("iOS " + UIDevice.current.systemVersion)
  14. default:
  15. result(FlutterMethodNotImplemented)
  16. }
  17. }
  18. public func initialize() {
  19. //设置AppKey,初始化友盟所有组件产品,开发者在友盟官网申请的appkey
  20. UMConfigure.initWithAppkey("66b07337cac2a664de82d457", channel: "AppStore")
  21. }
  22. }