gpt4 book ai didi

ios - 如何取消设置 NSFetchRequest 的 fetchLimit?

转载 作者:搜寻专家 更新时间:2023-10-31 22:01:29 24 4
gpt4 key购买 nike

documentation对于 Cocoa 的 NSFetchRequest fetchLimit 属性说:

The fetch limit specifies the maximum number of objects that a request should return when executed.

If you set a fetch limit, the framework makes a best effort to improve efficiency, but does not guarantee it.

但是,它没有告诉您如果已经设置了提取限制,如何取消限制请求应返回的最大对象数。

在我的 NSFetchRequest 上使用 fetchLimit 限制对象数量后,如何返回无限数量的匹配对象?

最佳答案

从一些快速测试中,当 NSFetchRequest 实例化时,fetchLimit 的默认值为 0,将值设置为 0 以外的值然后再设置回 0 将不限制返回的结果。

因此,从 Swift 4 开始,将 fetchLimit 设置为 0 以返回无限结果。

关于ios - 如何取消设置 NSFetchRequest 的 fetchLimit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46269186/

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