请建议在以下情况下如何在 Core Data 中创建关系:我创建了一个用户对象,其中包含两个指向同一个对象(地址)的关系,但关系名称是 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 个单独的地址对象。