首页 > 解决方案 > Ionic App Calling Native iOS function, Error: Ionic Native: deviceready did not fire within 5000ms

问题描述

我在 iOS 中有一个离子应用程序,我们在其中呈现一个本机屏幕并在那里调用一个 web 服务。从服务器获得响应后,我们再次向离子屏幕发送响应并关闭本机屏幕。

但是回调不起作用

WARN: Ionic Native: deviceready 没有在 5000 毫秒内触发。当插件处于不一致状态时,可能会发生这种情况。尝试从 plugins/ 中删除插件并重新安装它们。

 this.nativewebview.nativeMethod({}).subscribe((result) => {

  console.log('SUCCESS API CALL FROM NATIVE ------ >>>>> ');

   this.handleCloseWebView();


}, (err) => {
  console.log(err);

});

而iOS代码是

- (void)nativeMethod:(CDVInvokedUrlCommand*)command {
    [self apiCall command:command];
}

-(void)apiCall command:(CDVInvokedUrlCommand*)wsCommand {

    [webViewController callCheckoutWebService completionHandler:^(NSString * _Nullable result) {
        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:result];
        [self.commandDelegate sendPluginResult:pluginResult callbackId:wsCommand.callbackId];
        NSLog(@"=======1");
    }];

}

谁能告诉我可能是什么问题?

标签: iosobjective-ccordovaionic-framework

解决方案


推荐阅读