I have the following code to convert the body of a post request into a string
let body: NSData = self.createBodyWithParameters(paramString, filePathKey: "image_name", imageDataKey: imageData!, boundary: boundary, nameParam: "dparam_string_post")
let bodyString: String = NSString(data: body, encoding: NSUTF8StringEncoding) as! String
I get an error on the second line:
fatal error: unexpectedly found nil while unwrapping an Optional value
And the variable has content, I have made a print and it has shown me the content
EDITED I have also tried with:
let cadena = String(data: body, encoding: NSUTF8StringEncoding)
But it returns me nil