gpt4 book ai didi

objective-c - 核心数据故障

转载 作者:可可西里 更新时间:2023-11-01 03:35:28 26 4
gpt4 key购买 nike

我正在使用 Restkit 从服务器映射 Json 数据,并通过从数据库中获取来显示这些数据。我的 View 中有一个刷新按钮,它再次执行上述操作。

场景: 我有两个具有一对一关系的表 Key & Profile。我正在使用以下代码从数据库中获取数据

NSFetchRequest *fetchRequest = [Key fetchRequest];
[fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:@"Profile"]];
[fetchRequest setIncludesSubentities:YES];
NSArray *sortedObjects = [Key executeFetchRequest:fetchRequest];

以上数组返回数据库中的所有对象。但是当我使用断点检查时,我遇到了一些核心数据错误,这是没有显示所有数据的原因。

//sortedObjects中的所有数据都是这样

<Key: 0x889f2f0> (entity: Key; id: 0x889e400 <x-coredata://981A476D-55AC-4CB4-BBD8-E0285E522412/Key/p1489> ; data: <fault>)

任何想法

最佳答案

这可能是对“故障”的误解。

Apple's documentation 中所述:

Faulting is a mechanism Core Data employs to reduce your application’s memory usage.

A fault is a placeholder object that represents a managed object that has not yet been fully realized, or a collection object that represents a relationship:

因此,如果您在使用 Core Data 时在日志中看到“故障”一词,这并不意味着发生了错误。您在应用中发现了哪些意外行为?

关于objective-c - 核心数据故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13046291/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com