nativescript - 通过 NativeScript 在 GAITracker 上调用方法时出错
问题描述
我正在尝试使用以下代码在 iOS 中调用本机 GoogleAnalytics 跟踪器:
(googleAnalytics.getTracker() as any).setValueForKey(value, (global as any).GAIFields.customDimensionForIndex(key));
(value
这里是字符串,输出GAIFields.customDimensionForIndex(key)
也是字符串)
但我收到了这个错误:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GAITrackerImpl 0x2811e94a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key &cd1.'
我在这里做错了什么?
解决方案
根据官方文档,似乎只setValue
支持方法。
尝试,
(googleAnalytics.getTracker() as any).setValue((global as any).GAIFields.customDimensionForIndex(key), value);
推荐阅读
- python - 是否有一个简单的 python 3 命令可以在多列上复制 matlab 的 interp1 命令?
- c# - 数据库 sqlite 中的项目未更新 (Xamarin.Forms)
- html - 将页脚推到 flexbox 底部
- python-3.x - 一段代码的语法错误被接受为 str.join 的参数
- typescript - 在 TypeScript 中将对象值转换为类枚举类型
- python - 尝试在 Python 3 子进程中运行 rsync 时出现 args 问题
- click - 点击此代码的准确性必须小于 5 毫秒 但是为什么不呢?
- c# - Xamarin C# 选择 jsonArray 中的元素
- django - 如何从没有请求参数的函数返回模板?
- java - 与其他类具有相同包名的 Java 类