Cocoa error 3840 using JSON (iOS)

Unless you pass the option NSJSONReadingAllowFragments to [NSJSONSerialization JSONObjectWithData:options:error:] the response from the server must be valid JSON with a top level container which is an array or dictionary.

for example:

    { "response" : "Success" }

P.S.
If you want a mutable dictionary you must also include NSJSONReadingMutableContainers in your options.

Leave a Comment