ios - 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");
}];
}
谁能告诉我可能是什么问题?
解决方案
推荐阅读
- python - 使用小批量的 Spacy 文本分类
- pandas - 错误“方法”对象不可下标
- android - 如何修复Android中的“在谷歌驱动器上下载文件存储”错误
- java - 具有自定义属性的枚举的 ArrayList
- database - 消息系统的消息存储复制
- node.js - 如何在不安装 10gb gui 的情况下仅为依赖项获取 xcode?
- git - 使用 push 命令在服务器上创建和修改分支
- typescript - 不可能在函数/承诺中调用任何函数
- generics - 均值函数的 Rust 泛型语法
- reactjs - 在 react-router 中放置嵌套路由的位置?