Error Domain=NSCocoaErrorDomain Code=3840 \"Unescaped control character around character 981.\" UserInfo={NSDebugDescription=Unescaped control character a
NSLog the NSData that you received and have a look what you find around byte 981. The thing with unescaped control characters is that they are invisible, so you can't see them in an NSString, but you'll see them in the NSData.
If your data has length 981 bytes or very close then there's a chance that your code processed incomplete JSON data which will almost always fail; that's something you need to fix. If there is a control character between some items (say between two array elements) then this might be a bug in the server code.
to be sure (as people make fool copy/paste...) , I build my object safe: ..
private final func fillWith(
id: Int,
name: String?
) {
self.id = id
self.productName = name?.replacingOccurrences(of: "\t", with: "")
self.productName = self.productName?.replacingOccurrences(of: "\n", with: "")
So no prob when sending Up.
I spent some time to figure out what 49546 is. Adding this here to make it easier for someone else. If your issue is Unescaped control character around character 49546
replace \t with \\t
As per you told there is problem related to "\n"
So i suggest you can add "\" which will work for you like below
"\n"=> "\\n"
Because this are special character call backspace character.
Hope you get your answer