解析云代码:“无法调用null的方法'_toPointer'"在关系上调用.query()时 [英] Parse Cloud Code: "Cannot call method '_toPointer' of null" when calling .query() on a relation
问题描述
这是我一直在努力的事情,找不到快速的答案.最终,我意识到我没有正确查看Parse文档.
This is something that I struggled with, and couldn't find a quick answer for. Ultimately, I realized that I wasn't reviewing the Parse documentation properly.
问题
如果您正在阅读此问题,则可能是您的云代码错误日志中出现了以下错误
If you're reading this question, perhaps you're getting the following error in your Cloud Code error log
Result: TypeError: Cannot call method '_toPointer' of null
当您尝试调用Parse.Relation
的.query()
方法时.
when you try to call the .query()
method of a Parse.Relation
.
推荐答案
解决方案
首先考虑一下您可能错误地检索了该关系.我花了相当长的时间来努力理解为什么,如果我调用Parse.Object
的.get('RELATION_KEY')
方法,却不断收到此错误.
Consider that you may be retrieving the relation incorrectly, in the first place. I spent quite a while struggling to understand why, if I called the .get('RELATION_KEY')
method of a Parse.Object
, I kept getting this error.
我应该一直在打电话 .relation('RELATION_KEY')
.我知道这个是在Parse.Object文档中,但是我看到"get"并停止阅读.我的错.
I should have been calling .relation('RELATION_KEY')
instead. I know this is was in the Parse.Object documentation, but I saw "get" and stopped reading. My mistake.
希望有帮助.
这篇关于解析云代码:“无法调用null的方法'_toPointer'"在关系上调用.query()时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!