Search code examples
iosxcodeutf-8http-headersalamofire

NSMutableURLRequest setValue:forHTTPHeaderField xcode 6.2 not working for "application/json; charset=utf-8"


I am developing and app, with Alamofire, in Xcode 6.2, and by default Alamofire has this for .JSON encoding:

mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")

However, I need value to be like this:

mutableURLRequest.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")

The problem is that after this line, if I print allHTTPHeaderFields, I have:

(lldb) po mutableURLRequest.allHTTPHeaderFields!.description
"[Content-Type: application/json]"

Note: This is only happening in Xcode 6.2. It's working perfect in Xcode 6.1.1

Anybody can help? Thanks in advance.


Solution

  • Turned out to be something stupid: I had to re-compile the Alamofire project, after changing it. Works now.