nativescript - 带有角度的 Nativescript 6 中的错误 TS2339 : Property 'getter' does not exist on type 'typeof ios' .

标签 nativescript nativescript-angular

从版本 5 代码升级到最新版本的 Nativescript 6 开始在 utils 中给出 ios 的 getter 错误。
类型“typeof ios”上不存在属性“getter”。在带有角度的 Nativescript 6 中。
此代码负责在 IOS 上关闭键盘。

检查官方文档没有方法可用
https://docs.nativescript.org/core-concepts/utils#ios

还尝试通过对象属性访问运行后出错
utils.ios.getter() 已弃用;改用各自的原生属性
utils.ios['getter'](UIApplication, UIApplication.sharedApplication)

utils.ios.getter(UIApplication, UIApplication.sharedApplication)
        .keyWindow
        .endEditing(true);

Getter 应该在 ios utils 中可用

最佳答案

utils.ios.getter(...)已在 {N} v5.4 中弃用,可能在 v6 中已删除。您应该直接访问该属性。

UIApplication.sharedApplication.keyWindow.endEditing(true);

关于nativescript - 带有角度的 Nativescript 6 中的错误 TS2339 : Property 'getter' does not exist on type 'typeof ios' .,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56918708/

相关文章:

Android 上的 NativeScript Angular Basic 应用程序大小 > 160 MB

nativescript |layouts 为 ngFor 循环创建 ui

java - 如何覆盖 nativescript 中的重载 Java 方法?

angular - NativeScript Angular 6 双向绑定(bind)在 TextField 上不起作用

javascript - 在 NativeScript 应用程序中向 map 添加标记

javascript - 如何在 NativeScript 应用程序中导航多个页面?

javascript - 如果绑定(bind)到特定列表项的数组为空,则在 ListView 中显示该特定列表项

angular - NativeScript + Angular - 预览中的新项目错误 : Type AppRoutingModule does not have 'ngModuleDef' property

angular - Nativescript:无法覆盖模板中的 ActionBar

nativescript - 如何在 Nativescript 角度应用程序中包含可用的 gradle 库?