siegesmund / SwiftDDP

A Meteor client, written in Swift
MIT License
145 stars 60 forks source link

Still nvalid type in JSON write when "Call" with a Object #16

Closed Sadmansamee closed 8 years ago

Sadmansamee commented 8 years ago

Now I'm using

let jsonDictionary = try NSJSONSerialization.JSONObjectWithData(self.currentDeliveryAddress, options: []) as! NSDictionary 

And

class CurrentDeliveryAddress :NSData
{
    var streetName: String!
    var areaName: String!
    var buildingName: String!
    var apartmentName: String!
    var locationName: String!
    var cityName: String!
    var phoneNumber: String!
    var location: Location!
    var areaId: String!

    class Location 
    {
        var lat : Double!
        var lng : Double!

        init(lat:Double,lng :Double)
        {
            self.lat = lat
            self.lng = lng
        }
    }
}
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -bytes only defined for abstract class. Define -[UrbanChef.CurrentDeliveryAddress bytes]!' 

also tried with SwiftyJson

 let swiftyJson = JSON(data: self.currentDeliveryAddress)  

Same error