解析云代码给我代码:141错误 [英] Parse cloud code giving me Code: 141 error

查看:203
本文介绍了解析云代码给我代码:141错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

My 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!,而是发出以下错误:错误:找不到功能(代码:141,版本: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆