javascript - How to use Apple Pay in NativeScript
问题描述
I'm trying to make Apple Pay in NativeScript app by using native code.
But have some errors with data type (?)
let item = new PKPaymentSummaryItem();
item.label = "iPhone Xs 64 Gb";
item.amount = 39999;
JavaScript error:
file:///app/components/Home.vue:24:0 JS ERROR Error: -[__NSCFNumber decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector sent to instance 0xf549d0dbe6e8cc69
解决方案
正如错误消息所示,您需要正确进行打字转换。将软件包安装tns-platform-declarations
为项目的开发依赖项将为您提供方便的智能感知,它将指导您解决此类问题。对于这种特殊情况,请尝试:
item.amount = new NSDecimalNumber({ string: "29999" });
推荐阅读
- java - websphere 启动时 ibm 文件监控出错
- c# - 如何获取具有本地时间信息的 DateTimeOffset
- sql - 如何将具有特定标签的数据组织到新列中?
- c# - 比较两个数据集 A 和 B 并仅在 A 中返回数据
- javascript - 在传入要用作回调的函数时使用jQuery时对“this”感到困惑
- django - Django 创建和更新视图:外键字段
- c# - DateTime.AddHours 给出错误的输出和日期时间格式更改
- ios - 在 objc_object::release() 中崩溃
- java - 在java中实现以对象为参数的方法
- vector - 二进制补码向量 VHDL 的左移