对象之间的核心数据关系

时间:2013-10-31 16:15:43

标签: core-data ios6

请在以下情况中建议如何在Core Data中创建关系:我创建了一个用户对象,其中包含指向同一对象(地址)的2个关系,但关系名称是homeAddress和workAddress。但是在Xcode5上,它给出了一些警告,即反向关系不是倒数。

JSON:

 {
    "user": {
        "user_id": "123123",
        "email": "user@email.com",
        "first_name": "Jean Luc",
        "last_name": "Picard",
    "home_address": {
        "street": "DowningStreet",
        "number": "11",
        "city": "London",
        "state": "GreaterLondon",
        "country": "UnitedKingdom",
        "zip": "SW1A2QAB",
        "name": "Homesweethome",
        "created_at": "1365526421456",
        "location": {
            "latitude": 3.1,
            "longitude": 3.2
        }
    },
    "work_address": {
        "street": "AmphitheatreParkway",
        "number": "1600",
        "city": "MountainView",
        "state": "California",
        "country": "UnitedStates",
        "zip": "94043",
        "name": "WorkHarder",
        "created_at": "1365526642123",
        "location": {
            "latitude": 3.1,
            "longitude": 3.2
        }
    }
  }
}

我想避免创建2个单独的地址对象。

0 个答案:

没有答案