|
|
@@ -12,7 +12,16 @@ public class FlutterUmengPlugin: NSObject, FlutterPlugin {
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
|
switch call.method {
|
|
|
case "initCommon":
|
|
|
- initialize()
|
|
|
+
|
|
|
+ guard let args = call.arguments as? [String: Any],
|
|
|
+ let appKey = args["appKey"] as? String {
|
|
|
+ initialize(appKey:appKey)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ print("ios友盟初始化失败 没接收到appKey")
|
|
|
+ break
|
|
|
+
|
|
|
case "setPolicyGrantResult":
|
|
|
// initialize()
|
|
|
break
|
|
|
@@ -23,9 +32,9 @@ public class FlutterUmengPlugin: NSObject, FlutterPlugin {
|
|
|
}
|
|
|
|
|
|
// 初始化
|
|
|
- public func initialize() {
|
|
|
+ public func initialize(appKey: String) {
|
|
|
//设置AppKey,初始化友盟所有组件产品,开发者在友盟官网申请的appkey
|
|
|
- UMConfigure.initWithAppkey("66b07337cac2a664de82d457", channel: "AppStore")
|
|
|
+ UMConfigure.initWithAppkey(appKey, channel: "AppStore")
|
|
|
print("ios友盟初始化")
|
|
|
}
|
|
|
}
|