I have a string array stored in nsuserdefaults under someKey
key.
I'm building the Alamofire
query:
var params = [
"long": lon,
"lat": lat,
"startDate": DateCalc.convertValueToDate(defaults.floatForKey("startDate"))
] as [String: AnyObject]
Alamofire.request(.GET, "\(serverURL)/tests", parameters: (params))
.validate()
.responseJSON { response in
Now, based on some conditions, I would like to append to my params
array the previously set String array.
I tried doing it like this:
params["someKey"] = defaults.objectForKey("someKey")
but then the input params look as follows:
params: ["long": 19.09421499999999, "someKey": <__NSCFArray 0x7f8322713990>(
one, two, three ) , "lat": 51.90671500000001,"startDate": 2011-09-28T00:00:00.000Z]
how should I change it so that I can pass the array of strings instead, e.g.:
params: ["long": 19.09421499999999, "someKey": "one, two three", "lat": 51.90671500000001,"startDate": 2011-09-28T00:00:00.000Z]
let joinedString = ["one", "two", "three", "four", "five"].joinWithSeparator(", ")
print(joinedString)