更新到解析的最新版本后,我收到以下错误。
Result: Error: Cannot create a pointer to an unsaved ParseObject
at n.value (Parse.js:12:4222)
at n (Parse.js:14:607)
at Parse.js:14:374
at Array.map (native)
at n (Parse.js:14:351)
at Object.r.default (Parse.js:14:1071)
at Object.b._encode (Parse.js:11:15607)
at Object.success (<anonymous>:156:42)
at e.rQuery.find.success (main.js:279:22)
at e.<anonymous> (Parse.js:12:27827)
代码如下
rQuery.equalTo("rNumber", r2Number);
rQuery.descending("rDateTime");
rQuery.find({
success: function(results) {
results = editListForSectionHeader(results);
response.success(results);
},
error: function(error) {
// on error, log it
console.log(error.message);
response.success([]);
}
function editListForSectionHeader(results){
var previousDate = '';
var formatedResults = [];
for (var i = 0; i < results.length; i++) {
var object = results[i];
if(previousDate != object.get('rDate')){
var headerRow = new R();
headerRow.set("rDate", object.get('rDate'));
headerRow.set("rowType", "HEADER_ROW");
formatedResults.push(headerRow);
object.set("rowType", "DATA_ROW");
formatedResults.push(object);
previousDate = object.get('rDate');
headerRow.dirty = function() { return false; };
object.dirty = function() { return false; };
}else{
object.set("rowType", "DATA_ROW");
object.dirty = function() { return false; };
formatedResults.push(object);
}
}
return formatedResults;
}
基本上我通过查询获取一些数据,格式化结果数组,将脏属性设置为false并返回。它用于工作,但它已停止使用新版本。