l***@enjoyauto.com
l***@enjoyauto.com
  • 发布:2020-08-06 14:44
  • 更新:2020-11-10 13:05
  • 阅读:888

UniPluginProtocol 消息推送不能执行指定的方法

分类:uni-app

开发的插件,能够正常接收推送,但是推送的消息打开不能进入到指定的方法

  • application:(UIApplication _Nullable)application didReceiveRemoteNotification:(NSDictionary _Nullable)userInfo

  • (void)application:(UIApplication _Nullable)application didReceiveRemoteNotification:(NSDictionary _Nullable)userInfo fetchCompletionHandler:(void (^_Nullable)(UIBackgroundFetchResult))completionHandler

  • (void)application:(UIApplication _Nullable)application didReceiveLocalNotification:(UILocalNotification _Nullable)notification


@interface HookPluginProxy : NSObject <UniPluginProtocol>  
@end  

@implementation HookPluginProxy  

- (void)onCreateUniPlugin {  
    NSLog(@"UniPluginProtocol Func: %@,%s",self,__func__);  
}  

- (BOOL)application:(UIApplication *_Nullable)application didFinishLaunchingWithOptions:(NSDictionary *_Nullable)launchOptions {  
    NSLog(@"UniPluginProtocol Func didFinishLaunchingWithOptions: %@,%s",self,__func__);  

    return YES;  
}  

- (void)applicationDidBecomeActive:(UIApplication *_Nullable)application {  
    NSLog(@"UniPluginProtocol Func: %@,%s",self,__func__);  
}  

- (void)applicationDidEnterBackground:(UIApplication *_Nullable)application {  
    NSLog(@"UniPluginProtocol Func: %@,%s",self,__func__);  
}  

- (void)application:(UIApplication *_Nullable)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *_Nullable)deviceToken  
{  
    NSLog(@"%@",deviceToken);  
}  

- (void)application:(UIApplication *_Nullable)application didReceiveRemoteNotification:(NSDictionary *_Nullable)userInfo  
{  
    NSLog(@"didReceiveRemoteNotification:%@",userInfo);  
}  
- (void)application:(UIApplication *_Nullable)application didReceiveRemoteNotification:(NSDictionary *_Nullable)userInfo fetchCompletionHandler:(void (^_Nullable)(UIBackgroundFetchResult))completionHandler  
{  
    NSLog(@"didReceiveRemoteNotification:fetchCompletionHandler:%@",userInfo);  
}  
- (void)application:(UIApplication *_Nullable)application didReceiveLocalNotification:(UILocalNotification *_Nullable)notification  
{  
    NSLog(@"didReceiveLocalNotification");  
}
2020-08-06 14:44 负责人:无 分享
已邀请:
l***@enjoyauto.com

l***@enjoyauto.com (作者)

问题已经找到了

c***@126.com

c***@126.com

同样问题,请问怎么解决的?

  • l***@enjoyauto.com (作者)

    把生成的库在导入到你的测试项目中,否则不执行

    2020-08-12 10:34

fcbflying

fcbflying

你的问题都解决了吗?

我的插件开发出来后,在hbuilder中集成后。
didRegisterForRemoteNotificationsWithDeviceToken 这个方法没有调用。
didFinishLaunchingWithOptions这个方法是调用了的。
不知道什么原因呢?

你的qq多少呢,咨询一下呢,多谢!

  • 1***@163.com

    你好 请问你的问题解决了吗?我遇到了同样的问题

    2020-11-26 10:09

  • fcbflying

    回复 1***@163.com: 解决了,还要继承 UNUserNotificationCenterDelegate 这个

    2020-11-26 13:41

该问题目前已经被锁定, 无法添加新回复