ios - 解析云代码给我代码 : 141 error
<p><p>我的 Parse 云代码的结构如下:</p>
<pre><code>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);
}
});
});
</code></pre>
<p>我从我的 iOS 应用程序中调用该函数,如下所示:</p>
<pre><code>- (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 .
// Pass the selected object to the new view controller.
}
</code></pre>
<p>基本上我想做的是将用户输入的任何搜索查询输入到 itemSearch 字段中,ping eBay 的数据库,然后返回具有最多结果的 categoryID。但是,Parse 没有记录“Successfully ping eBay!”,而是给出以下错误:<code>Error: function not found (Code: 141, Version: 1.2.18)</code></p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我猜这个函数本身有问题。我已经看到了该错误消息的几个示例,实际上是功能出现故障,而不是丢失。</p>
<p>在云代码指南中,我找到了这个例子:</p>
<pre><code>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.get("stars");
}
response.success(sum / results.length);
},
error: function() {
response.error("movie lookup failed");
}
});
});
</code></pre>
<p>此函数根据状态调用 response.success 和 response.error。你的好像没有。</p></p>
<p style="font-size: 20px;">关于ios - 解析云代码给我代码 : 141 error,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22616799/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22616799/
</a>
</p>
页:
[1]