如何在Swift中传递两个参数

时间:2016-10-05 05:00:35

标签: swift parse-platform

我正在尝试传递PFCloud...行中的两个参数。当我为"token":myVal参数实现withParameters时,代码可以正常工作,但在我尝试添加useremail时也不起作用。我想知道我该怎么做。

var useremail = PFUser.currentUser()?.objectForKey("username") as! String
PFCloud.callFunctionInBackground("customer", withParameters: ["token":myVal] && ["email":useremail], block: { (success: AnyObject?, error: NSError?) -> Void in

1 个答案:

答案 0 :(得分:3)

Process() // method to be called after regular interval in Timer { // lengthy process, i.e. data fetching and processing etc. // here comes the UI update part Dispatcher.Invoke((Action)delegate() { /* update UI */ }); } 的类型为Parameters。要将元素添加到Dictionary,您需要使用逗号分隔键值对。

所以而不是:

Dictionary

你想:

["token":myVal] && ["email":useremail]

由于:

["token":myVal, "email":useremail]

将是["token":myVal] && ["email":useremail] 类型的表达式,而不是Bool类型的表达式。