如何使用Javascript SDK调用带有参数的云代码函数
我知道在iOS sdk中我可以这样做如何使用Javascript SDK调用带有参数的云代码函数,javascript,parse-platform,sdk,parse-cloud-code,Javascript,Parse Platform,Sdk,Parse Cloud Code,我知道在iOS sdk中我可以这样做 [PFCloud callFunctionInBackground:@"email" withParameters:@{@"param1": @"quantity1, @"param2": @"quantity2} block:^(NSString *result, NSError *error) { if (error) { //error } else { // make sure the set the
[PFCloud callFunctionInBackground:@"email" withParameters:@{@"param1": @"quantity1, @"param2": @"quantity2} block:^(NSString *result, NSError *error) {
if (error) {
//error
} else {
// make sure the set the email sent flag on the object
NSLog(@"result :%@", result);
}
}];
但是如何使用Javascript函数来实现这一点呢
Parse.Cloud.run("email", { param1:"quantity1", param2:"quantity2" }).then(function(result) {
// make sure the set the email sent flag on the object
console.log("result :" + JSON.stringify(result))
}, function(error) {
// error
});
使用下面的代码可以完美地工作
NSDictionary *param = [[NSDictionary alloc] initWithObjectsAndKeys:@"A",@"param1",@"B",@"param2", nil];
[PFCloud callFunctionInBackground:@"email" withParameters:param block:^(id object, NSError *error)
{
}];
NSDictionary *param = [[NSDictionary alloc] initWithObjectsAndKeys:@"A",@"param1",@"B",@"param2", nil];
[PFCloud callFunctionInBackground:@"email" withParameters:param block:^(id object, NSError *error)
{
}];