我正在研究leanplum,我只是按照他们的说明使用Javascript进行设置。
这是我的代码:
<script type="text/javascript" src="leanplum.min.js"></script>
<script type="text/javascript" src="sw.min.js"></script>
<script>
// This value should be set to true only if you're developing on your server.
var isDevelopmentMode = true;
// Sample variables. This can be any JSON object.
var variables = {
items: {
color: 'red',
size: 20,
showBadges: true
},
showAds: true
};
// We've inserted your Test API keys here for you :)
if (isDevelopmentMode) {
Leanplum.setAppIdForDevelopmentMode("xxx", "xxx");
} else {
Leanplum.setAppIdForProductionMode("xxx", "xxx");
}
Leanplum.setVariables(variables);
Leanplum.start(function(success) {
console.log('Success: ' + success);
console.log('Variables', Leanplum.getVariables());
});
</script>
我收到此错误:
leanplum.min.js:1 Uncaught TypeError: Cannot read property 'test2' of undefined
at leanplum.min.js:1
at leanplum.min.js:1
at Function.value (leanplum.min.js:1)
at leanplum.min.js:1
at leanplum.min.js:1
at Function.value (leanplum.min.js:1)
at Function.value (leanplum.min.js:1)
at response (leanplum.min.js:2)
at leanplum.min.js:1
我不知道此错误的原因是什么。有什么帮助吗?谢谢!