-[NSURL startAccessingSecurityScopedResource]
状态的文档:
You must balance every call to the startAccessingSecurityScopedResource method with a corresponding call to the stopAccessingSecurityScopedResource method. If you fail to relinquish your access when you no longer need a file-system resource, your app leaks kernel resources. If sufficient kernel resources are leaked, your app loses its ability to add file-system locations to its sandbox, such as via Powerbox or security-scoped bookmarks, until relaunched.
有人能解释一下内核资源的实际限制吗?
我不想让我的应用程序达到这些确切的限制,只是知道一个大概的数字会很有帮助,这样我就可以判断代码是否做过任何危险/愚蠢的事情。
最佳答案
大概数字在 1000 到 2500 之间。我在苹果开发者论坛上读到了最近的三篇讨论。如果您是 Apple 的注册开发人员,您可以在这里找到它:
- 千余:Limitation of startAccessingSecurityScopedResource NSURLs
- 2500 左右:sandbox_consume_fs_extension
- 通过 QuickLook 精确查找 1000:Getting sandbox access to many files
关于nsurl - 当前安全范围书签的内核资源限制是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16225311/