本文介绍了在“withParameters:"中发送多个参数称呼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Hello I need to know how to send two objects through a withParameters: method.

这是我的代码:

    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 一切正常,但我需要包含它.我该怎么做?

Everything works fine if I take out messageparam from the PFCloud call but I need to include it. How do i do this?

推荐答案

你会把它们放在一个字典里:

You'd put them in a dictionary together:

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;

这篇关于在“withParameters:"中发送多个参数称呼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 01:36