IOS 7 JSON不会解析'自己'的文件

时间:2013-12-31 01:15:36

标签: ios objective-c json

我有一个IOS 7应用程序,它读取我手动创建的JSON文件,一切正常。如果我使用JSON序列化将NSDictionary写回来,我会得到一些看起来像JSON文件的东西,但是我的应用程序不会再次读回来。唯一的区别在于对象的排序,就像我所知道的那样。

唯一的错误信息是:

无法完成操作。 (可可错误3840.)和{     NSDebugDescription =“垃圾终结。”;

以下是违规文件:

>     {   "favourites" : [
>     {
>       "stars" : 3,
>       "job id" : 345
>     },
>     {
>       "stars" : 4,
>       "job id" : 1102
>     },
>     {
>       "stars" : 2,
>       "job id" : 2323
>     }   ],   "student id" : 1234,   "session" : "1a174a40e1f86f589e5a3a5e9b40e053",   "name" : "Gregory",   "password"
> : "",   "portfolio" : {
>     "work" : [
>       {
>         "type" : "Home Farm",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       },
>       {
>         "type" : "Vets",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       }
>     ],
>     "notes" : [
>       {
>         "type" : "2013-12-12",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       },
>       {
>         "type" : "2013-12-15",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       }
>     ],
>     "hobbies" : [
>       {
>         "type" : "Ferret-keeping",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       },
>       {
>         "type" : "Stamp-collecting",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       }
>     ],
>     "achievements" : [
>       {
>         "type" : "Everest Base Camp",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       },
>       {
>         "type" : "Duke of Edinburgh Silver",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       }
>     ],
>     "UCAS" : [
>       {
>         "type" : "Personal Statement",
>         "blurb" : "Lorem ipsum dolor sit amet."
>       }
>     ],
>     "skills" : [
>       {
>         "type" : "stamina",
>         "blurb" : "I can keep going..."
>       },
>       {
>         "type" : "shorthand",
>         "blurb" : "I can write shorthand and even read it sometimes!"
>       }
>     ]   },   "timestamp" : "2013-12-31 00:48:11.540",   "career scores" : [
>     {
>       "match" : 72,
>       "interest" : 95,
>       "career area id" : 47
>     },
>     {
>       "match" : 53,
>       "interest" : 95,
>       "career area id" : 82
>     },
>     {
>       "match" : 62,
>       "interest" : 90,
>       "career area id" : 12
>     },
>     {
>       "match" : 75,
>       "interest" : 85,
>       "career area id" : 23
>     },
>     {
>       "match" : 70,
>       "interest" : 85,
>       "career area id" : 27
>     },
>     {
>       "match" : 69,
>       "interest" : 85,
>       "career area id" : 41
>     }   ],   "qualifications" : [
>     {
>       "subject id" : 21,
>       "level" : "GCSE",
>       "grade" : "A*"
>     },
>     {
>       "subject id" : 1,
>       "level" : "GCSE",
>       "grade" : ""
>     }   ] }

感谢您提供任何帮助。

1 个答案:

答案 0 :(得分:0)

该文件未被完全覆盖。比前一版本短的输出导致了这个问题。