Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.
Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.
- Subject: Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.
- From: Scott Ribe <email@hidden>
- Date: Fri, 26 Jul 2013 21:52:06 -0600
On Jul 26, 2013, at 9:35 PM, Public <email@hidden> wrote:
> Thanks Scott and Jens for sharing your thoughts.
>
> I didn't set up entitlements (yet), but when launched from within Xcode, my (non-sandboxed Cocoa) app was able to read and clear ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 created by system. However, when launched from Finder, the app launches and doesn't do anything — I'm checking the console log file (my thanks to Todd Haberlein for the tip) and also developing an alternative approach using sqlite and 3rd party wrappers (my thanks to Jerry Krinock, Robert Martin, and Jens Alfke for suggesting).
>
> This experience has definitely piqued my curiosity about the difference in "access rights" of an app launched from within Xcode. I would expect difference in app behavior for an iOS app launched on device versus simulator, but am baffled by the difference in behavior of launching the same OS X app in Xcode versus from the Finder.
>
> Thanks to everyone from sharing, I'm still exploring and welcome any other suggestion.
Good grief, I didn't notice that you said "non-sandboxed". The biggest difference between being launched under Xcode and launched from the Finer, in terms of questions to this list from confused devs, is the default working directory. Check your paths. Check the path of the prefs file you want to access, check the file of the helper utility you're launching via NSTask, check every path you're using to make sure that you're ultimately using full paths and that they're correct. (I'd just use NSLog, and look at the console output after a run where it "doesn't do anything"--if you see either the wrong full path or a relative path, there's your problem.)
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden