Error Domain=NSCocoaErrorDomain Code=3840 \"Unescaped control character around character 981.\" UserInfo={NSDebugDescription=Unescaped control character a
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