Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
AFNetwork を ( JSONKit と共に) 使用すると、エラーが発生しました:
Domain=JKErrorDomain Code=-1 "不正な \u Unicode エスケープ シーケンスです。" UserInfo=0x834cab0 {JKAtIndexKey=218、JKLineNumberKey=1、NSLocalizedDescription=不正な \u Unicode エスケープ シーケンス。}
検索するとこんな詳細がわかる
この問題の修正または回避策はありますか?
まず、不正なシーケンスが何であるかを調べる必要があります。
不正なデータを送信しないように Web サービスを修正できない場合は、JSON を評価する前に応答を前処理する必要があります。
あなたが引用したソースでは、単純な正規表現を使用して、s/[\u0000-\u001f]/\\uFFFD/g20 未満のすべての生の ASCII 文字を無効にしています。無効なシーケンスによっては、これも機能する場合があります。
s/[\u0000-\u001f]/\\uFFFD/g