@Realm:RLMArray <>每次返回不同的實例
爲什麼我的RLMArray在運行時會給出不同的對象實例?
這是我如何定義我的RLMArray:
@property RLMArray<HouseImage> *images;
我添加/刪除HouseImage
對象數組的所有時間(交易)。
當我訪問圖片爲:每次我得到不同的情況下,時間
_house.images[indexPath.row]
即
(lldb) p _house
(RLMAccessor_v0_House *) $52 = 0x00000001701a5780
2015-08-30 23:02:07.695 Apt Note[5992:1308601] Loading image named: 1C178A31-5F33-4CD3-9B7C-B026DF7A5E19_2
2015-08-30 23:02:07.731 Apt Note[5992:1308601] Loading image named: CFD99689-12C4-49CB-AAB6-850FFCD902D7_3
2015-08-30 23:02:07.750 Apt Note[5992:1308601] Loading image named: 194D55EA-125A-4CFC-8CCF-758E929BE7D5_4
// This is the first time when iterating the array. The [house] object remains same, but not the images array items.
(lldb) p _house
(RLMAccessor_v0_House *) $53 = 0x00000001701a5780
(lldb) p _house.images[0]
(RLMAccessor_v0_HouseImage *) $54 = 0x00000001740bbf60
2015-08-30 23:02:36.947 Apt Note[5992:1308601] Loading image named: 1C178A31-5F33-4CD3-9B7C-B026DF7A5E19_2
2015-08-30 23:02:36.986 Apt Note[5992:1308601] Loading image named: CFD99689-12C4-49CB-AAB6-850FFCD902D7_3
2015-08-30 23:02:37.031 Apt Note[5992:1308601] Loading image named: 194D55EA-125A-4CFC-8CCF-758E929BE7D5_4
// This is the second iteration
(lldb) p _house
(RLMAccessor_v0_House *) $55 = 0x00000001701a5780
(lldb) p _house.images[0]
(RLMAccessor_v0_HouseImage *) $56 = 0x00000001740bc140
如果你看我的日誌中,house
對象保持不變。但是,RLMArray
(images
)中的實例已經無處改變。除了這段代碼之外,沒有人在這種情況發生時正在讀/寫領域。
有沒有人知道爲什麼會發生這種情況?
如果我不清楚,請告訴我,我會盡力解釋清楚。