无法发送Cordova插件结果

时间:2018-02-21 09:55:49

标签: javascript ios objective-c cordova

我是Cordova的新手,我在dismissedViewController之后发送结果并且我将变量传递给Plugin类

- (void)coolMethod:(CDVInvokedUrlCommand*) mycommand
{
    _callbackId=mycommand.callbackId; //here im saving plugin id
    NSDictionary* myarg = [mycommand.arguments objectAtIndex:0];

    LiveViewController *viewController = [[LiveViewController alloc]initWithNibName:@"LiveViewController" bundle:nil];

    viewController.openTokApi_Key = [[myarg safeObjectForKey:@"apiKey"] stringValue];

    viewController.openTokSessionID = [myarg safeObjectForKey:@"liveSessionId"];

    viewController.openTokToken = [myarg safeObjectForKey:@"tokenId"];

    viewController.hybridParams = myarg;

    [self.viewController presentViewController:viewController animated:YES  completion:nil];
}

完成我的任务后,我解除了ViewController,并为此调用创建了实例,并调用了下面的方法

-(void)result:(NSString *)success
{

CDVPluginResult* pluginResult=[CDVPluginResult 
  resultWithStatus:CDVCommandStatus_OK messageAsString:@"ok"];

  [self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];

}

但是,我无法在我的JS中获得此结果。

0 个答案:

没有答案