Firebase事件监听器从未触发(iOS应用)

时间:2019-04-30 17:04:10

标签: ios firebase google-cloud-functions firebase-analytics

我正在尝试使用Firebase函数在我的应用中触发事件时做一些事情:

const functions = require('firebase-functions');

const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.sendIAPAnalytics = functions.analytics.event('IAP').onLog((event) => {           
    console.log("event done");
    return true;
});

我的事件“ IAP”被标记为转换。 该事件将显示在Analytics DebugView中。

在我的iOS应用中调用了“ IAP”事件:

Analytics.logEvent("IAP", parameters: nil)

功能部署可以,没有错误。

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /Users/cmilliet/Documents/APP TEST/functions
> eslint .

✔  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (39.34 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: updating Node.js 8 function sendIAPAnalytics(us-central1)...
✔  functions[sendIAPAnalytics(us-central1)]: Successful update operation. 

✔  Deploy complete!

但是功能日志中什么也没有出现。

仅供参考,我已经实现了另一个功能(onUpdate),没有任何麻烦。

我错过了什么?

1 个答案:

答案 0 :(得分:1)

仅来自Analytics(分析)的转化事件会触发Cloud Functions。

由于IAP似乎是一个自定义事件,因此您需要mark it as a conversion event