因此,我必须实施沙盒以将我的 Mac 应用程序保留在 Mac 应用程序商店中。当我启用沙盒时,我的应用程序大部分都可以工作。我使用“top”命令来获取整个用户系统的 CPU 信息和 RAM 信息。有了沙盒,我就无法再使用这些功能了。这是收到的运行时错误:
/bin/sh: /usr/bin/top: Operation not permitted
/bin/sh: /usr/bin/top: Operation not permitted
2012-05-29 20:40:57.911 QuickToggles[53714:403] *** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
2012-05-29 20:40:57.928 QuickToggles[53714:403] (
0 CoreFoundation 0x00007fff986bcf56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff97f98d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff98666370 -[__NSArrayI objectAtIndex:] + 208
3 QuickToggles 0x0000000100001961 -[StatusBarAppAppDelegate updateInfo:] + 177
4 Foundation 0x00007fff94666f40 __NSFireTimer + 102
5 CoreFoundation 0x00007fff98671934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
6 CoreFoundation 0x00007fff98671486 __CFRunLoopDoTimer + 534
7 CoreFoundation 0x00007fff98651e11 __CFRunLoopRun + 1617
8 CoreFoundation 0x00007fff98651486 CFRunLoopRunSpecific + 230
9 HIToolbox 0x00007fff9806b4d3 RunCurrentEventLoopInMode + 277
10 HIToolbox 0x00007fff980726d3 ReceiveNextEventCommon + 181
11 HIToolbox 0x00007fff9807260e BlockUntilNextEventMatchingListInMode + 62
12 AppKit 0x00007fff90441e31 _DPSNextEvent + 659
13 AppKit 0x00007fff90441735 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
14 AppKit 0x00007fff9043e071 -[NSApplication run] + 470
15 AppKit 0x00007fff906ba244 NSApplicationMain + 867
16 QuickToggles 0x0000000100001882 main + 34
17 QuickToggles 0x0000000100001854 start + 52
18 ??? 0x0000000000000003 0x0 + 3
)