我得到的错误如下。我发现当我查询一个“未定义”的字段时会发生这种情况。
那么如何检查Parse中未定义的字段?
"Message": "An error has occurred.",
"ExceptionMessage": "The given key was not present in the dictionary.",
"ExceptionType": "System.Collections.Generic.KeyNotFoundException",
"StackTrace": " at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at Parse.ParseObject.get_Item(String key)\r\n at Parse.ParseObject.Get[T](String key)\r\n
答案 0 :(得分:1)
假设您指的是Parse.com
平台的ParseObject类,您可以在调用Get之前使用ParseObject.ContainsKey方法检查密钥是否存在,例如:< / p>
if (someParseObject.Contains(someKey))
myVar=someParseObject.Get(someKey);