macos - 如何确定是否启用了沙箱

标签 macos appkit entitlements

如何检查在 OSX 应用程序运行时是否启用了沙箱?

我需要它来对我的库进行一些断言测试,这些测试可以在不同的环境中运行。

最佳答案

This might help

  1. In Finder, look at the contents of the ~/Library/Containers/ folder.

    If the Quick Start app is sandboxed, there is now a container folder named after your app. The name includes the company identifier for the project, so the complete folder name would be, for example, com.yourcompany.AppSandboxQuickStart.

    The system creates an app’s container folder, for a given user, the first time the user runs the app.

  2. In Activity Monitor, check that the system recognizes the app as sandboxed.

    • Launch Activity Monitor (available in /Applications/Utilities).

    • In Activity Monitor, choose View > Columns. Ensure that the Sandbox menu item is checked.

    • In the Sandbox column, confirm that the value for the Quick Start app is Yes.

    To make it easier to locate the app in Activity monitor, enter the name of the Quick Start app in the Filter field.

  3. Check that the app binary is sandboxed.

codesign -dvvv --entitlements :- executable_path

关于macos - 如何确定是否启用了沙箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33335278/

相关文章:

ios - 无论是否启用权利,Mac 应用程序都会崩溃(由于权利而终止)

ios - 缺少 HealthKit 权利

macos - NSTableView reloadData(forRowIndexes :columnIndexes:) breaks autolayout

swift - 动画 NSImageView 翻译

cocoa - 多次使用 NSApplication runModalForWindow

ruby - 在 macrubyc 中使用 --static 选项时出错

php - SYMFONY - 在 os x 10.5 上正确设置 PDO-MYSQL

ruby - 如何覆盖、阻止或恢复 Homebrew 对编译标志的更改

objective-c - 正确处理 NSURLConnection 错误