尝试将对象保存到CloudKit记录时获取nil

时间:2015-10-23 10:52:21

标签: swift cloudkit

我试图将对象保存到CloudKit记录 my CloudKit model

function parseBatchResponse(response) {
  // Not the same delimiter in the response as we specify ourselves in the request,
  // so we have to extract it.
  var delimiter = response.substr(0, response.indexOf('\r\n'));
  var parts = response.split(delimiter);
  // The first part will always be an empty string. Just remove it.
  parts.shift();
  // The last part will be the "--". Just remove it.
  parts.pop();

  var result = [];
  for (var i = 0; i < parts.length; i++) {
    var part = parts[i];
    var p = part.substring(part.indexOf("{"), part.lastIndexOf("}") + 1);
    result.push(JSON.parse(p));
  }
  return result;
}

here is a console

1 个答案:

答案 0 :(得分:0)

我最终在谷歌搜索“cloudkit此请求需要经过身份验证的帐户”。对我来说问题是我没有在模拟器中登录iCloud。