在"withParameters:"调用中发送多个参数

ian*_*ian 0 objective-c parse-platform

您好我需要知道如何通过withParameters:方法发送两个对象.

这是我的代码:

    NSDictionary *numberparam = [NSDictionary dictionaryWithObject:phoneNumber  forKey:@"number"];
    NSDictionary *messageparam = [NSDictionary dictionaryWithObject:message forKey:@"message"];

    [PFCloud callFunctionInBackground:@"inviteWithTwilio" withParameters:numberparam messageparam block:^(id object, NSError *error) {
        NSString *message1 = @"";
Run Code Online (Sandbox Code Playgroud)

如果我从PFCloud调用中取出messageparam但是我需要包含它,一切正常.我该怎么做呢?

Log*_*gan 6

你可以把它们放在一本字典中:

NSMutableDictionary * params = [NSMutableDictionary new];
params[@"number"] = phoneNumber;
params[@"message"] = message;
[PFCloud callFunctionInBackground:@"inviteWithTwilio" withParameters:params block:^(id object, NSError *error) {
    NSString *message1 = @""; 
}];
Run Code Online (Sandbox Code Playgroud)

然后,在云使用中

var phoneNumber = request.number;
var message = request.message;
Run Code Online (Sandbox Code Playgroud)