2014-03-14 48 views
0

您好,我需要知道如何通過withParameters:方法發送兩個對象。在「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但我需要把它列入。我該怎麼做呢?

回答

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; 
+0

感謝這就是我解決了第一個問題,但現在卻這樣說: – ian

+0

不兼容的指針類型發送' NSArray *'參數的類型'NSDictionary *' – ian

+0

您是否看到更新,我的第一個原始數組答案是錯誤的。我在你看到它之前嘗試更新! – Logan