1

I have developed an sandboxing app. One of its features is to make some changes to the /Users/username/Library/Preferences com.apple.finder.plist. So in order to do so, I have added the following to my entitlement.plist:

<key>com.apple.security.temporary-exception.shared-preference.read-write</key>
<array>
    <string>com.apple.finder</string>
</array>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
    <string>com.apple.finder</string>
    <string>com.apple.systemevents</string>
</array>

My app works perfectly fine if I turn off sandboxing, however, if I enable sandboxing, sometimes my app works but most of the time my apps doesn't work.

What I did was, 1. I used NSAppleScript to make changes to the finder.plist, then 2. tell "finder" to quit and relaunch again. the "quit" and relaunch part works perfectly fine:

tell application "Finder" to quit
set inTime to current date
    repeat
tell application "System Events"
    if "Finder" is not in (get name of processes) then exit repeat
end tell
if (current date) - inTime is greater than 10 then exit repeat
    delay 0.2
end repeat

tell application "Finder" to activate

(from How to relaunch finder application)

however the changing finder.plist doesn't always seems to work. (no error) But if I turn off sandboxing, it works.

So my conclusion is, sandboxing breaks my code, but I really don't know how to fix this, because I have already added the entitlement?

Community
  • 1
  • 1
Josh
  • 692
  • 2
  • 9
  • 38

1 Answers1

3

Probably you want to enable sandboxing to make an App Store eligible app. I think you will have hard time (impossible) to get your app approved with temporary exemptions especially with system events and finder.

If you are granted those temporary exemptions, you can do pretty much everything which does not require root access i.e. delete files, etc. It defeats the purpose of sandboxing.

Restarting Finder from your app would be never allowed for sure. I recommend you to find another way to do what you need to do.

Tibidabo
  • 21,461
  • 5
  • 90
  • 86