简体   繁体   中英

WLActionReceiver not working on MobileFirst 8

i'm implementing the WLActionReceiver protocol in our Cordova-based MobileFirst 8 application.

I'm trying to send actions from Javascript to Native (Objective c) but actions are not received or the onActionReceived method is not called.

I implemented this code into the wlInitDidCompleteSuccessfully method to setup the ActionReceiver.

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

And this is the ActionReceiver code:

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:

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

Can someone help me?

Thank you

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

cordova platform remove ios
cordova platform add ios

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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