在" withParameters中发送多个参数:"呼叫

时间:2014-03-14 05:35:29

标签: 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 = @"";

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

1 个答案:

答案 0 :(得分:6)

你将它们放在字典中:

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

然后,在云端使用

var phoneNumber = request.number;
var message = request.message;