나는 며칠 동안 HTTP 요청에서 검색 한 파일을 저장하는 데 어려움을 겪고 있습니다.CloudCode를 사용하여 Parse.com의 URL에서 이미지 저장
Parse.Cloud.httpRequest({
url: "https://ss1.4sqi.net/img/categories_v2/food/vietnamese_88.png",
success: function(httpImgFile)
{
console.log("httpImgFile: " + String(httpImgFile.buffer));
var imgFile = new Parse.File("imgFile1.png", httpImgFile.buffer);
object.set("location", "newYork"); //object is a PFObject retrieved earlier
object.set("icon1", imgFile);
object.save(null, {
success: function(gameScore) {
response.success("saved object");
},
error: function(gameScore, error) {
response.error("failed to save object");
}
});
},
error: function(httpResponse)
{
console.log("unsuccessful http request");
response.error(responseString);
}
});
내가 오류는 다음과 같습니다 : 여기 내 코드입니다
Failed with: TypeError: Cannot call method 'then' of undefined
at Object.b.File.save (Parse.js:2:14963)
at null.<anonymous> (Parse.js:2:30041)
at e (Parse.js:2:6339)
at Parse.js:2:7092
at g (Parse.js:2:6829)
at c.extend.then (Parse.js:2:7077)
at Parse.js:2:30016
at Array.forEach (native)
at Function.x.each.x.forEach (Parse.js:1:661)
at Function.b.Object._deepSaveAsync (Parse.js:2:29993)
모든이에 대한 이상한 부분은 내가 수정할 수 있어요 object.set("icon1", imgFile)
라인을 포함 할 때 오류가 발생합니다 있다는 것입니다 object
의 위치는 문제가되지 않습니다. 이 오류는 전적으로 imgFile
을 (를) 저장하려고 할 때 발생합니다. icon1
도움이 될만한 점이 있으면 감사하겠습니다. 감사!
여기서 'object' 변수의 출처는 어디입니까? '객체'의 타입은 무엇입니까? – wayne
개체는 "외부 목록"유형의 PFObject입니다. 아마 도움이되지 않을 것입니다. –