Serialize custom object to JSON which contains NSMutableArray

前端 未结 3 1465
旧巷少年郎
旧巷少年郎 2020-12-22 02:27

I\'m trying to serialize my Cart object which has an NSMutableArray of items in it but getting an:

*** Terminating app due to uncaught exception \

3条回答
  •  礼貌的吻别
    2020-12-22 03:01

    This line: [itemsToSerialize addObject:item]; should be [itemsToSerialize addObject:itemDict];. The result is that you're trying to serialize an array of the items themselves, which gives the exception you're seeing.

提交回复
热议问题