Giter VIP home page Giter VIP logo

getui-flutter-plugin's Introduction

Getui Flutter Plugin

1、引用

Pub.dev: getui-flutter-plugin

增加依赖:

flutter pub add getuiflut

或者手动在工程 pubspec.yaml 中加入 dependencies:

dependencies:
  getuiflut: ^0.2.28

下载依赖:

flutter pub get
flutter run

2、配置

2.1、Android:

参考官网文档中心进行配置:https://docs.getui.com/getui/mobile/android/overview/

flutter插件默认包含自定义组件,Flutter用户不用处理以下配置:

  • Android->集成指南-> 3.配置推送服务-> FlutterPushService ("继承自 com.igexin.sdk.PushService 的自定义 Service")

  • Android->集成指南-> 6.编写集成代码-> FlutterIntentService ("继承自 com.igexin.sdk.GTIntentService 的自定义 Service")

注意: ^0.2.19开始getuiflut不再默认依赖GTSDK,请自己在android/app/build.gradle文件下增加依赖,如:

dependencies {
    implementation 'com.getui:gtsdk:3.2.18.0'  //个推SDK
    implementation 'com.getui:gtc:3.2.6.0'  //个推核心组件
}

2.2、iOS:

在你项目的main.dart中添加下列代码:

   Getuiflut().startSdk(
      appId: "8eLAkGIYnGAwA9fVYZU93A",
      appKey: "VFX8xYxvVF6w59tsvY6XN",
      appSecret: "Kv3TeED8z19QwnMLdzdI35"
   );

启用notification:xcode主工程配置 > Signing & Capabilities > +Push Noticifations

注意:

Apple 在 iOS 10 中新增了Notification Service Extension机制,可在消息送达时进行业务处理。为精确统计消息送达率,在集成个推SDK时,可以添加 Notification Service Extension,并在 Extensions 中添加 GTExtensionSDK 的统计接口,实现消息展示回执统计功能。具体可参考个推集成文档

3、使用

import 'package:getuiflut/getuiflut.dart';

3.1、公共 API

  • 公共 API
/**
	* 绑定别名功能:后台可以根据别名进行推送
	*
	* @param alias 别名字符串
	* @param aSn   绑定序列码, Android中无效,仅在iOS有效
	*/
bindAlias(alias, sn);
unbindAlias(alias, sn);

/**
  *  给用户打标签 , 后台可以根据标签进行推送
  *
  *  @param tags 别名数组
  */
setTag(tags);

/**
  *  停止SDK服务
  *
  */
turnOffPush();

/**
  *  开启SDK服务
  *
  */
turnOnPush();
  • 回调方法
Getuiflut().addEventHandler(
    	// 注册收到 cid 的回调
      onReceiveClientId: (String message) async {
        print("flutter onReceiveClientId: $message");
        setState(() {
          _getClientId = "ClientId: $message";
        });
      },
    	// 注册 DeviceToken 回调
      onRegisterDeviceToken: (String message) async {
        setState(() {
          _getDeviceToken = "DeviceToken: $message";
        });
      },
    	// SDK收到透传消息回调
      onReceivePayload: (Map<String, dynamic> message) async {
        setState(() {
          _onReceivePayload = "$message";
        });
      },
    	// 点击通知回调
      onReceiveNotificationResponse: (Map<String, dynamic> message) async {
        setState(() {
          _onReceiveNotificationResponse = "$message";
        });
      },
    	// APPLink中携带的透传payload信息
      onAppLinkPayload: (String message) async {
        setState(() {
          _onAppLinkPayLoad = "$message";
        });
      },
    	//通知服务开启\关闭回调
      onPushModeResult: (Map<String, dynamic> message) async {
        print("flutter onPushModeResult: $message");
      },
	// SetTag回调
      onSetTagResult: (Map<String, dynamic> message) async {
        print("flutter onSetTagResult: $message");
      },
	//设置别名回调
      onAliasResult: (Map<String, dynamic> message) async {
        print("flutter onAliasResult: $message");
      },
	//查询别名回调
      onQueryTagResult: (Map<String, dynamic> message) async {
        print("flutter onQueryTagResult: $message");
      },
	//APNs通知即将展示回调
      onWillPresentNotification: (Map<String, dynamic> message) async {
        print("flutter onWillPresentNotification: $message");
      }, 
	//APNs通知设置跳转回调
      onOpenSettingsForNotification: (Map<String, dynamic> message) async {
        print("flutter onOpenSettingsForNotification: $message");
      }, 
      onGrantAuthorization: (String granted) async {
        print("flutter onGrantAuthorization: $granted");
      },
    );

3.2、Android API

/**
	*初始化个推sdk
	*/
Getuiflut.initGetuiSdk();
/**
*设置角标
*/
  setBadge(badge);

3.2、iOS API

首先,开发者需要在AppDelegate.m中,重写APNs系统方法,如:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    //warning: 需要重写当前方法,gtsdk的接管系统方法就会生效,否则会影响回执
    //保持空实现
}
  • GTSDK<=2.4.6.0版本,需要使用插件版本<=0.2.5
  • GTSDK>2.4.6.0版本,需要使用最新插件版本
    /**
    *  启动sdk+通知授权
    */ 
    startSdk(appId,appKey,appSecret);
    

    /**
    *  启动sdk
    */ 
    startSdkSimple(appId,appKey,appSecret);


    /**
    *  通知授权,需要先启动sdk。
    */ 
    registerRemoteNotification(appId,appKey,appSecret);
 

    /**
    *  获取冷启动APNs参数
    */
    getLaunchNotification();

    /**
    *  同步服务端角标
    */
    setBadge(badge);

    /**
    *  复位服务端角标
    */
    resetBadge();

    /**
    *  同步App本地角标
    *
    */
    setLocalBadge(badge); 

    /*
    *  开启\关闭后台模式
    */
    runBackgroundEnable(enable)
    
    /*
    *  注册灵动岛token。支持版本2.7.3.0及以上。 
    *  GTSDK>=3.0.3.0,会有onLiveActivityResult回调
    */
    registerActivityToken(aid, token,sn) 

getui-flutter-plugin's People

Contributors

cljian avatar huqx-getui avatar monkeydbobo avatar vickygit avatar wutianjusouth avatar yangshgetui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getui-flutter-plugin's Issues

iOS 在 Kill 掉 App 的时候收到的 APNs 推送,点击后没有进入对应的回调

您好,我 Debug 了一下,在 iOS 上点击某条消息是进入 onReceiveNotificationResponse 回调的(App 在前台或者后台时),但是当 Kill 掉 App 之后,APNs 推送的确可以收到,但是点击这条推送并没有走 onReceiveNotificationResponse 回调(我是使用 Toast 来测试的),这是为何呢?

另外, 在前台的时候发送透传消息接收到的回调是 onReceivePayload,如果此时也要发送一条横幅通知,如果做到呢?是需要在对应的 iOS 和安卓分别提供原生的方法给 Flutter 调用吗?

再者,这些方法居然是干嘛的呢:onNotificationMessageClicked、onNotificationMessageArrived、onReceiveMessageData。发现代码没有在这些回调出现过,但是这命名感觉是点击了消息、消息到达、收到消息啥的,这不是跟上面的两个回调重叠?还是有做其他考虑?

个推推送华为审核不通过

我按照demo上的写法
manifestPlaceholders = [
GETUI_APP_ID : "xxxx",
GETUI_APP_KEY : "xxxx",
GETUI_APP_SECRET : "xxxx",
// 下面是多厂商配置,如需要开通使用请联系技术支持
// 如果不需要使用,预留空字段即可
XIAOMI_APP_ID : "",
XIAOMI_APP_KEY : "",
MEIZU_APP_ID : "",
MEIZU_APP_KEY : "",
HUAWEI_APP_ID : "",
OPPO_APP_KEY : "",
OPPO_APP_SECRET : "",
VIVO_APP_ID : "",
VIVO_APP_KEY : ""
]

华为自己本身的推送服务没有集成,出现华为应用市场无法审核通过。
如下错误:
错误:28: 集成HMS需要将证书文件打包到APK中,请直接将assets目录拷贝到应用工程根目录。 ;
一般:16: 集成低版本HMSAgent或者Activity配置错误(activity配置:com.huawei.android.hms.agent.pay.HMSPayAgentActivity) ;
提示:17: 应用接入API:(接入push)

什么原因

点击通知,App启动没有收到回调

android
flutter 1.9.1+hotfix.2
app退出后收到通知, 点击通知唤起APP,
没有回调 onNotificationMessageClicked,也没有回调onReceiveMessageData

IOS 调用startSdk后未触发onReceiveClientId事件

Getuiflut().startSdk(
    appId: 'xxxx',
    appKey: 'xxxx',
    appSecret: 'xxxx'
);

Getuiflut().addEventHandler(
  // 此事件未触发
  onReceiveClientId: (String clientId) { 
    print('个推服务ClientId, ${clientId.toString()}');
  },
);

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-3.0.pre.27, on Mac OS X 10.15.4 19E287, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.46.0)
[✓] Connected device (1 available)

• No issues found!

ios 绑定别名无效

ios 绑定别名无效
个推后台查询不到别名

Android 正常 后台能查询到

android 控制台能输出绑定了别名
ios控制台只输出了cid 没有输出别名

小米厂商推送时打不开应用

杀掉应用由个推网页创建的推送,通过厂商推送后,手机收到推送,点击通知时没打开应用

透传和通知消息表现一致
`
05-13 20:12:08.179 21453 21789 D GetuiflutPlugin: Getui flutter plugin doesn't exist

05-13 20:12:08.494 21453 21789 D GetuiflutPlugin: Getui flutter plugin doesn't exist

05-13 20:12:08.496 21453 21789 D GetuiflutPlugin: Getui flutter plugin doesn't exist
`

在 iOS 13 中推送消息不弹出

#15 问题解决(引入了 flutter_call_kit )之后,iOS 13 的设备应用在后台时不弹出消息推送,iOS 12 设备正常;

初始化 GetuiSdk 的代码和文档中的一样;
flutter doctor:

[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.14.4 18E194d, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
[✓] Android Studio (version 3.2)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (2 available)

Xcode 中的设置也是一样的:
image

iOS 13 启动应用时控制台有这样的信息(1):

[] nw_connection_copy_connected_path [C3] Client called nw_connection_copy_connected_path on unconnected nw_connection
[] tcp_connection_is_cellular No connected path
[] nehelper sent invalid result code [1] for Wi-Fi information request

将应用转为后台运行时,有这样的信息( flutter issue #41095 ):

Can't end BackgroundTask: no background task exists with identifier 10 (0xa), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.

上面这两条控制台信息在 iOS 12 设备上时不存在的,会是这个原因吗?我并不懂 iOS。。。

初始化个推SDK报错

flutter: got zone error: MissingPluginException(No implementation found for method initGetuiPush on channel getuiflut), #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)

#1 Getuiflut.initGetuiSdk (package:getuiflut/getuiflut.dart:38:20)

#2 GeTuiUtils.initGetuiSdk (package:b2b/utils/getui.dart:23:17)

// 文档和demo能否说明的详细一点。

接入 flutter 插件版的推送,与华为引用内支付有类冲突。

错误:接入 flutter 插件版的推送,与华为引用内支付有类冲突。

错误原因:

华为支付依赖的是 'com.huawei.hms:iap:5.0.2.300'。

个推 flutter 引用的是 getuiflut: ^0.2.3

冲突原因是一些类在个推的 GetuiSDK-support-HWP-1.0.5.jar 中有,也在 com.huawei.hms 引用的库中。

java.lang.RuntimeException: Duplicate class com.huawei.hms.activity.BridgeActivity found in modules GetuiSDK-support-HWP-1.0.5.jar (GetuiSDK-support-HWP-1.0.5.jar) and classes.jar (com.huawei.hms:ui:5.0.0.301)
  Duplicate class com.huawei.hms.activity.a found in modules GetuiSDK-support-HWP-1.0.5.jar (GetuiSDK-support-HWP-1.0.5.jar) and classes.jar (com.huawei.hms:base:5.0.0.301)
  Duplicate class com.huawei.hms.api.Api found in modules GetuiSDK-support-HWP-1.0.5.jar (GetuiSDK-support-HWP-1.0.5.jar) and classes.jar (com.huawei.hms:base:5.0.0.301)
  Duplicate class com.huawei.hms.api.Api$ApiOptions found in modules GetuiSDK-support-HWP-1.0.5.jar (GetuiSDK-support-HWP-1.0.5.jar) and classes.jar (com.huawei.hms:base:5.0.0.301)

请问有什么可以解决的方式吗?

个推 flutter 版的官方地址: https://github.com/GetuiLaboratory/getui-flutter-plugin

华为应用内支付的文档:https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/integrating-sdk-0000001050035023

【Problem】didn't find class "com.getui.getuiflut.FlutterPushService"

Log

D/GetuiflutPlugin(24410): init getui sdk...test
E/PushManager(24410): call - > initialize, parameter [userServiceName] is set, but didn't find class "com.getui.getuiflut.FlutterPushService", please check your AndroidManifest
E/PushManager(24410): call - > registerPushIntentService, parameter [userIntentService] is set, but didn't find class "com.getui.getuiflut.FlutterIntentService", please check your AndroidManifest

I set with doc but sdk init error

targetSdkVersion=31时,不能打包

当使用targetSdkVersion = 31 编译时提示错误信息“Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

经过检查清单文件发现,部分带有intent-filter的receiver和service没有添加android:exported,如下:
`

        <intent-filter>

            <action
                android:name="com.huawei.intent.action.PUSH_DELAY_NOTIFY" />

            <action
                android:name="com.huawei.intent.action.PUSH" />
        </intent-filter>
    </receiver>

    <receiver
        android:name="com.huawei.hms.support.api.push.PushReceiver"
        android:permission="com.cscec.odin.smartodin.permission.PROCESS_PUSH_MSG"
        android:directBootAware="true">

        <intent-filter>

            <action
                android:name="com.huawei.android.push.intent.REGISTRATION" />

            <action
                android:name="com.huawei.android.push.intent.RECEIVE" />
        </intent-filter>
    </receiver>

    <receiver
        android:name="com.igexin.sdk.PushReceiver">

        <intent-filter>

            <action
                android:name="android.intent.action.BOOT_COMPLETED" />

            <action
                android:name="android.net.conn.CONNECTIVITY_CHANGE" />

            <action
                android:name="android.intent.action.USER_PRESENT" />

            <action
                android:name="android.intent.action.MEDIA_MOUNTED" />

            <action
                android:name="android.intent.action.ACTION_POWER_CONNECTED" />

            <action
                android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
        </intent-filter>
    </receiver>

    <receiver
        android:name="com.meizu.cloud.pushsdk.SystemReceiver"
        android:process=":pushservice">

        <intent-filter>

            <action
                android:name="com.meizu.cloud.pushservice.action.PUSH_SERVICE_START" />

            <category
                android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>

    <receiver
        android:name="com.igexin.sdk.FlymePushReceiver"
        android:process=":pushservice">

        <intent-filter>

            <action
                android:name="com.meizu.flyme.push.intent.MESSAGE" />

            <action
                android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />

            <action
                android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />

            <action
                android:name="com.meizu.c2dm.intent.REGISTRATION" />

            <action
                android:name="com.meizu.c2dm.intent.RECEIVE" />

            <category
                android:name="com.cscec.odin.smartodin" />
        </intent-filter>
    </receiver>

    <service
        android:name="com.igexin.sdk.OppoPushService"
        android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE"
        android:process=":pushservice">

        <intent-filter>

            <action
                android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
        </intent-filter>
    </service>

    <service
        android:name="com.igexin.sdk.OppoAppPushService"
        android:permission="com.heytap.mcs.permission.SEND_PUSH_MESSAGE"
        android:process=":pushservice">

        <intent-filter>

            <action
                android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE" />

            <action
                android:name="com.heytap.msp.push.RECEIVE_MCS_MESSAGE" />
        </intent-filter>
    </service>

    <receiver
        android:name="com.igexin.sdk.VivoPushMessageReceiver"
        android:process=":pushservice">

        <intent-filter>

            <action
                android:name="com.vivo.pushclient.action.RECEIVE" />
        </intent-filter>
    </receiver>`

ios 没有stopPush

ios系统,换手机登录账号后,旧手机还能接受推送,新登录的手机收不到推送。插件里没有实现ios的stopPush,是什么原因?

ios inapp 的时候 收不到通知,回调不触发

app 在background 的时候 有pushnotification 显示,但app 在前台的时候 就收不到通知了,点几的时候 也没有回调
android 的版本可以
flutter 版本:2.5.3
plugin 版本:0.2.18
ios 版本:15.7.2

bug:1、resume 2、resetBadge

Getuiflut().resumePush();
应该是清空通知吗?
调用报错!
如果不是清空通知的话
哪个是,看文档上边是 clearAllNotificationForNotificationBar
插件上也没有调用这个呀。

源码GetuiflutPlugin.M

  • handleMethodCall:result
    47 行是不是有问题?

Getuiflut().resetBadge();
这个是复位角标吗?好像无效

Google play因为Meizu SDK审核不通过

您好,
我们集成了个推的flutter插件,在个推后台配置了特殊机型字段。请问个推的flutter插件会自动集成这些特殊机型的sdk吗?
我们并没有单独集成魅族sdk,但Googleplay审核时,因为Meizu sdk未通过审核。

执行 flutter buid apk 命令后,安装 apk 文件,应用获取不到 clientId

问题

我用此仓库的 demo 测试,发现在执行 flutter build apkflutter install 命令后,应用获取不到clientId:
问题演示.gif

这个问题和我的应用的问题一致;
但是,在 debug 模式下,没有这个问题;
我使用 adb logcat 命令查看设备日志,发现了一下有可能是错误的信息:

E ple:pushservic: ----- class 'Lcom/igexin/push/extension/mod/SecurityUtils;' cl=0x12c716d8 -----
E ple:pushservic:   objectSize=233 (224 from super)
E ple:pushservic:   access=0x0008.0001
E ple:pushservic:   super='java.lang.Class<java.lang.Object>' (cl=0x0)
E ple:pushservic:   vtable (0 entries, 11 in super):
E ple:pushservic:   direct methods (9 entries):
E ple:pushservic:      0: void com.igexin.push.extension.mod.SecurityUtils.<clinit>()
E ple:pushservic:      1: byte[] com.igexin.push.extension.mod.SecurityUtils.a()
E ple:pushservic:      2: byte[] com.igexin.push.extension.mod.SecurityUtils.b(byte[], byte[], byte[])
E ple:pushservic:      3: byte[] com.igexin.push.extension.mod.SecurityUtils.c(byte[], byte[], byte[])
E ple:pushservic:      4: byte[] com.igexin.push.extension.mod.SecurityUtils.d(byte[])
E ple:pushservic:      5: byte[] com.igexin.push.extension.mod.SecurityUtils.e()
E ple:pushservic:      6: byte[] com.igexin.push.extension.mod.SecurityUtils.h(byte[])
E ple:pushservic:      7: byte[] com.igexin.push.extension.mod.SecurityUtils.j()
E ple:pushservic:      8: byte[] com.igexin.push.extension.mod.SecurityUtils.k()
E ple:pushservic:   static fields (3 entries):
E ple:pushservic:      0: java.lang.String com.igexin.push.extension.mod.SecurityUtils.a
E ple:pushservic:      1: boolean com.igexin.push.extension.mod.SecurityUtils.b
E ple:pushservic:      2: java.lang.String com.igexin.push.extension.mod.SecurityUtils.c
E ple:pushservic: 
E ple:pushservic: Failed to register native method com.igexin.push.extension.mod.SecurityUtils.f([B[B[B)[B in /data/app/com.getui.getuiflut_example-qEnGwT2ngc-MNizg8mGXJw==/base.apk

clientid: load1 so error = java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.getui.getuiflut_example-qEnGwT2ngc-MNizg8mGXJw==/lib/arm64/libgetuiext3.so"

我的环境

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.14.4 18E194d, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.2)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

flutter --version

Flutter 1.12.13+hotfix.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f139b11009 (2 weeks ago) • 2020-03-30 13:57:30 -0700
Engine • revision af51afceb8
Tools • Dart 2.7.2

点击消息通知栏的消息,触发onReceiveNotificationResponse,再调用相册会重复调用onReceiveNotificationResponse

步骤:
1.推送消息,点击消息通知栏的消息,触发onReceiveNotificationResponse(此步没问题)
2.在onReceiveNotificationResponse中有个跳转到对应页面的处理(此步没问题)
3.退出对应页面,在前一个页面中触发调用系统相册,选择图片后,点击确认,会再次触发onReceiveNotificationResponse(有问题)

期望是:点击消息通知栏的消息,触发onReceiveNotificationResponse后,后续操作不再触发onReceiveNotificationResponse

Xcode15环境运行报错

ARC Semantic Issue (Xcode): No known class method for selector 'registerActivityToken:'
/Users/xxx/.pub-cache/hosted/pub.flutter-io.cn/getuiflut-0.2.21/ios/Classes/GetuiflutPlugin.m
:222:14

Xcode查看是个推SDK3.0.3没有registerActivityToken这个方法?

官方插件初始化报错

iOS端:初始化报错

[GeTuiSdk startSdkWithAppId:ConfigurationInfo[@"appId"] appKey:ConfigurationInfo[@"appKey"] appSecret:ConfigurationInfo[@"appSecret"] delegate:self];

在 xcode 11.2 中, 使用 个推,iOS应用无法启动

在 Flutter 中使用 个推,应用无法启动,报错如下:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'PushKit apps that use VoIP push must link either CallKit or IncomingCallNotifications frameworks.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff23c4f02e __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x00007fff50b97b20 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff23c4eda8 +[NSException raise:format:arguments:] + 88
	3   Foundation                          0x00007fff256c9b61 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   PushKit                             0x00007fff2afe296f +[PKPushRegistry _checkIfNecessaryVoIPFrameworksAreLinked] + 251
	5   PushKit                             0x00007fff2afe2cdc -[PKPushRegistry _registerForPushType:] + 287
	6   PushKit                             0x00007fff2afe375f __38-[PKPushRegistry setDesiredPushTypes:]_block_invoke + 240
	7   libdispatch.dylib                   0x00000001077e9d48 _dispatch_client_callout + 8
	8   libdispatch.dylib                   0x00000001077f89bf _dispatch_lane_barrier_sync_invoke_and_complete + 132
	9   PushKit                             0x00007fff2afe364e -[PKPushRegistry setDesiredPushTypes:] + 108
	10  Runner                              0x00000001051e5554 -[GetuiflutPlugin voipRegistration] + 180
	11  Runner                              0x00000001051e469c -[GetuiflutPlugin startSdk:result:] + 396
	12  Runner                              0x00000001051e4055 -[GetuiflutPlugin handleMethodCall:result:] + 469
	13  Flutter                             0x00000001058064fd __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
	14  Flutter                             0x000000010579fec0 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
	15  Flutter                             0x00000001057a3780 _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
	16  Flutter                             0x0000000105800db3 _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_31NS_9allocatorIS8_EEFvvEEclEv + 57
	17  Flutter                             0x00000001057b23f1 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 123
	18  Flutter                             0x00000001057b7742 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
	19  CoreFoundation                      0x00007fff23bb2944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
	20  CoreFoundation                      0x00007fff23bb2632 __CFRunLoopDoTimer + 1026
	21  CoreFoundation                      0x00007fff23bb1c8a __CFRunLoopDoTimers + 266
	22  CoreFoundation                      0x00007fff23bac9fe __CFRunLoopRun + 2238
	23  CoreFoundation                      0x00007fff23babe16 CFRunLoopRunSpecific + 438
	24  GraphicsServices                    0x00007fff38438bb0 GSEventRunModal + 65
	25  UIKitCore                           0x00007fff4784fb68 UIApplicationMain + 1621
	26  Runner                              0x00000001051bdb70 main + 112
	27  libdyld.dylib                       0x00007fff51a1dc25 start + 1
	28  ???                                 0x0000000000000001 0x0 + 1
)

我的环境:

[✓] Flutter (Channel unknown, v1.8.3, on Mac OS X 10.14.4 18E194d, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
[✓] Android Studio (version 3.2)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)

如果我不调用 initGetuiSdk();Getuiflut().startSdk()就不会报错,这是什么原因?并且应该 和flutter 版本无关, 我尝试了flutter最新版本也同样报错

闪退

E/AndroidRuntime(24175): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/igexin/sdk/PushManager;
E/AndroidRuntime(24175): at com.getui.getuiflut.GetuiflutPlugin.bindAlias(GetuiflutPlugin.java:210)
E/AndroidRuntime(24175): at com.getui.getuiflut.GetuiflutPlugin.onMethodCall(GetuiflutPlugin.java:135)
E/AndroidRuntime(24175): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/AndroidRuntime(24175): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(24175): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/AndroidRuntime(24175): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime(24175): at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime(24175): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(24175): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(24175): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(24175): at android.app.ActivityThread.main(ActivityThread.java:7872)
E/AndroidRuntime(24175): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(24175): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(24175): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(24175): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.igexin.sdk.PushManager" on path: DexPathList[[zip file "/data/app/~~84uKaMG_fkX8rGJULq-TtA==/com.example.openim_enterprise_chat-qU12zlEs5-tonFA9Fd8elA==/base.apk"],nativeLibraryDirectories=[/data/app/~~84uKaMG_fkX8rGJULq-TtA==/com.example.openim_enterprise_chat-qU12zlEs5-tonFA9Fd8elA==/lib/x86_64, /data/app/~~84uKaMG_fkX8rGJULq-TtA==/com.example.openim_enterprise_chat-qU12zlEs5-tonFA9Fd8elA==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(24175): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
E/AndroidRuntime(24175): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(24175): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(24175): ... 14 more
I/Process (24175): Sending signal. PID: 24175 SIG: 9
Lost connection to device.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.