I am getting a NSInvalidArgumentException when I try to run the following JSONSerialization
using Alamofire
on swift 3
code.
try! JSONSerialization.data(withJSONObject: postData, options: JSONSerialization.WritingOptions.prettyPrinted)
On debug, postData
is returning the value below.
key __NSCFString * "demographicsPojo" 0x000060800005e8a0
value _TtC7MyApp16DemographicsPojo * 0x6080001c5cd0 0x00006080001c5cd0
[0] _TtC7MyApp16DemographicsPojo
createdTimeMilliSecs Int64? 1487253369999
dateOfBirthMilliSecs Int64? 1487253369999
demographicsRoleType Int? 3
gender Int? 0
isDemographicsActive Int? 3
isRecordActive Int? 0
isTermsAndConditionsAccepted Int? 3
licenseExpiryDate Int64? 1487253369999
mobilePhone String? "9876543210" some
termsAndConditionsAcceptedTime Int64? 1487253369999
termsAndConditionsText String? "" some
updatedTimeMilliSecs Int64? 1487253369999
I am new to Swift 3
. I used my Android based JSON files to reverse engineer the DemographicsPojo
to swift. I wonder if I need to avoid using Optionals
completely in the Pojo's ? Is that the issue ?