简体   繁体   English

WLActionReceiver在MobileFirst 8上不起作用

[英]WLActionReceiver not working on MobileFirst 8

i'm implementing the WLActionReceiver protocol in our Cordova-based MobileFirst 8 application. 我正在基于Cordova的MobileFirst 8应用程序中实现WLActionReceiver协议。

I'm trying to send actions from Javascript to Native (Objective c) but actions are not received or the onActionReceived method is not called. 我正在尝试将动作从Javascript发送到本机(目标c),但未接收到动作或未调用onActionReceived方法。

I implemented this code into the wlInitDidCompleteSuccessfully method to setup the ActionReceiver. 我将此代码实现到wlInitDidCompleteSuccessfully方法中,以设置ActionReceiver。

[[WL sharedInstance] addActionReceiver:[[ActionReceiver alloc] init]];

And this is the ActionReceiver code: 这是ActionReceiver代码:

ActionReceiver.h 动作接收器

#import <Foundation/Foundation.h>
#import <IBMMobileFirstPlatformFoundationHybrid/WLActionReceiver.h>

@interface ActionReceiver : NSObject<WLActionReceiver>
@end

ActionReceiver.m 动作接收器

#import "ActionReceiver.h"

@implementation ActionReceiver

- (void)onActionReceived:(NSString *)action withData:(NSDictionary *)data {
    NSLog(@"onActionReceived");
}

I'm using this code to send action from Javascript: 我正在使用以下代码从Javascript发送操作:

var data = {someproperty:1234};
WL.App.sendActionToNative("DeviceID", data);

Can someone help me? 有人能帮我吗?

Thank you 谢谢

这似乎是一个设置问题,因为执行以下操作可以解决该问题:

cordova platform remove ios
cordova platform add ios

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM