What are the current kernel resource limits on security-scoped bookmarks?

前提是你 提交于 2020-01-01 03:29:31

问题


The docs for -[NSURL startAccessingSecurityScopedResource] state:

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.

Can anybody shed any light on what the limit on kernel resources actual is?

I don't wish to make my app reach these exact limits, just that it would be helpful to know a ballpark figure so I can judge if code is ever doing anything dangerous/stupid.


回答1:


Ballpark figure is between 1000 and 2500. I read three recent discussions in the Developer Forums at apple. If you are a registered developer at apple you may find it here:

  • More than thousand: Limitation of startAccessingSecurityScopedResource NSURLs
  • At about 2500: sandbox_consume_fs_extension
  • Exact 1000 with QuickLook: Getting sandbox access to many files


来源:https://stackoverflow.com/questions/16225311/what-are-the-current-kernel-resource-limits-on-security-scoped-bookmarks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!