解析云代码给我代码:141 错误 [英] Parse cloud code giving me Code: 141 error
问题描述
我的 Parse 云代码结构如下:
My Parse cloud code is structured like so:
Parse.Cloud.define("eBayCategorySearch", function(request, response) {
url = 'http://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=*APP ID GOES HERE*';
Parse.Cloud.httpRequest({
url: url,
params: {
'OPERATION-NAME' : findItemsByKeywords,
'SERVICE-VERSION' : '1.12.0',
'RESPONSE-DATA-FORMAT' : JSON,
'callback' : _cb_findItemsByKeywords,
'itemFilter(3).name=ListingType' : 'itemFilter(3).value=FixedPrice',
'keywords' : request.params.item,
// your other params
},
success: function (httpResponse) {
// deal with success and respond to query
},
error: function (httpResponse) {
console.log('error!!!');
console.error('Request failed with response code ' + httpResponse.status);
}
});
});
我从我的 iOS 应用程序中调用该函数,如下所示:
and I call the function from within my iOS app like so:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if (sender != self.nextButton) return;
if (self.itemSearch.text.length > 0) {
[PFCloud callFunctionInBackground:@"eBayCategorySearch"
withParameters:@{@"item": self.itemSearch.text}
block:^(NSNumber *category, NSError *error) {
if (!error) {NSLog(@"Successfully pinged eBay!");
}
}];
}
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
基本上我想要做的是将用户在 itemSearch 字段中键入的任何搜索查询,ping eBay 的数据库,并返回具有最多结果的 categoryID.然而,Parse 没有记录成功 ping eBay!",而是给出了以下错误:Error: function not found (Code: 141, Version: 1.2.18)
Essentially what I want to do is take whatever search query a user types into the itemSearch field, ping eBay's database, and return the categoryID with the most results. However, rather than logging "Successfully pinged eBay!", Parse is giving the following error: Error: function not found (Code: 141, Version: 1.2.18)
推荐答案
我猜函数本身有问题.我已经看到了该错误消息的几个示例,但确实是该功能出现故障,而不是缺失.
I'm guessing there is something wrong with the function itself. I have seen several examples of that error message when indeed it was the function malfunctioning, not missing.
在云代码指南中,我找到了这个例子:
In the cloud code guide, I found this example:
Parse.Cloud.define("averageStars", function(request, response) {
var query = new Parse.Query("Review");
query.equalTo("movie", request.params.movie);
query.find({
success: function(results) {
var sum = 0;
for (var i = 0; i < results.length; ++i) {
sum += results[i].get("stars");
}
response.success(sum / results.length);
},
error: function() {
response.error("movie lookup failed");
}
});
});
此函数调用 response.success 和 response.error,具体取决于状态.你的好像没有.
This function calls response.success and response.error, depending on state. It seems yours do not.
这篇关于解析云代码给我代码:141 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!