简体   繁体   English

找不到解析云功能

[英]Parse Cloud function not found

I call a function in Cloud Code, but this function doesn't work. 我在Cloud Code中调用了一个函数,但是此函数不起作用。 The error in Xcode is: Xcode中的错误是:

[Error]: function not found (Code: 141, Version: 1.9.0)

This is the objective-c code: 这是objective-c代码:

NSDictionary *dictionary = [[NSDictionary alloc]initWithObjectsAndKeys:
                            titleString,@"title",
                            descriptionString, @"description",
                            nil];

[PFCloud callFunctionInBackground:@"saveNewItem"
                   withParameters:@{@"data": dictionary}
                            block:^(NSString *result, NSError *error) {
                                if (!error) {

                                } else {

                                    NSLog(@"Error");

                                }
                            }];

The function: 功能:

Parse.Cloud.define("saveNewItem", function(request, response) {

Parse.Cloud.useMasterKey();
var item = new Parse.Object("Item");
var title = request.params.data.title;
item.save({
        success:function (item) {
            response.success("Saved");
        },
        error:function (error) {
            response.error(error.message);
        }
    }
);
});

I read that it can happen if there is not the response success. 我读到,如果没有成功的响应就可能发生。 But in this case there is. 但是在这种情况下。

The strange thing is that I have other similar functions that do not have problems. 奇怪的是,我还有其他没有问题的类似功能。

Thanks 谢谢

In case you split you code into multiple modules you need to import them in the main.js file. 如果将代码拆分为多个模块,则需要将其导入main.js文件中。

So, edit you main.js file and use the require function: 因此,编辑main.js文件并使用require函数:

require('cloud/file.js');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM