NSArrayController 子类在 fetchWithRequest 中 setFetchLimit
我有一个绑定到 CoreData 支持的 NSArrayController 的 NSPopupButton。
我对 NSArrayController 进行了子类化以设置 fetchLimit 和 SortDescriptor。
问题如下:
FetchLimit 仅适用于初始加载。当以编程方式将条目添加到 CoreData Store 时,NSPopupButton 会反映并显示新条目,但不应用提取限制。我还尝试将 merge: 参数设置为 NO,但这似乎不会影响更新/重新获取。
- (BOOL) fetchWithRequest:(NSFetchRequest *)fetchRequest
merge:(BOOL)merge
error:(NSError **)error
{
if(fetchRequest)
[fetchRequest setFetchLimit:10];
NSLog(@"fetchWithRequest: %@", fetchRequest);
return [super fetchWithRequest:fetchRequest merge:NO error:error];
}
我错过了什么吗?
I have a NSPopupButton that is bound to a CoreData backed NSArrayController.
I subclassed the NSArrayController to set a fetchLimit and SortDescriptor.
The problem is the following:
The FetchLimit only applies on the initial load. When entries are added to the CoreData Store programatically, the NSPopupButton reflects and shows the new entries, but does not apply the fetch limit. I also tried to set the merge: parameter to NO, but this doesn't seem to affect the updates/refetches.
- (BOOL) fetchWithRequest:(NSFetchRequest *)fetchRequest
merge:(BOOL)merge
error:(NSError **)error
{
if(fetchRequest)
[fetchRequest setFetchLimit:10];
NSLog(@"fetchWithRequest: %@", fetchRequest);
return [super fetchWithRequest:fetchRequest merge:NO error:error];
}
am i missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论