NSInvalidArgumentException, reason: 'Invalid type in JSON write (__NSDate)'

前端 未结 8 2340
南旧
南旧 2021-02-04 01:05

I\'m getting this exception when I try to JSON encode NSDate object.I believe NSDate is not compatible for JSON encoding. but I must encode the date.Any solutions?



        
8条回答
  •  萌比男神i
    2021-02-04 01:15

    You must convert the date to a string before you try to encode it. There are enough examples everywhere so it should be easy to find

提交回复
热议问题