• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sandboxing and calling Launchctl
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sandboxing and calling Launchctl


  • Subject: Re: Sandboxing and calling Launchctl
  • From: Mark Allan <email@hidden>
  • Date: Tue, 29 May 2012 12:36:23 +0100

On 29 May 2012, at 12:24, Stephane Sudre wrote:
> On Tue, May 29, 2012 at 10:52 AM, Mark Allan
> Hi all,
>>
>> I posted this to the developer forums yesterday but I think this list probably gets a good bit more eyeball than the forum, so I'm sending here too. Sorry for the cross-post if you're seeing it twice.  Anyway...
>>
>> I'm trying to put together the last bits and pieces of sandboxing my app but I've just hit a problem.  I don't appear to be able to use launchctl to schedule tasks any more.
>>
>> With my app sandboxed, I'm launching an NSTask with the following launch path and arguments:
>>> /bin/launchctl load -w /Users/mark/Library/Containers/<my app identifier>/Data/Library/LaunchAgents/<my app identifier>.helpername.plist
>>
>>
>> I'm using the correct APIs to get the path and read/write the helpername.plist file.  As per other command line tools I launch via NSTask, launchctl is presumably inheriting the same entitlements as my main application, but launchctl obviously needs to modify other files to which my app normally wouldn't have access - namely:[...]
>
> SMLoginItemSetEnabled can be a solution.
>
> https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html

Hi Stephane,

Thanks for your reply, but that's not quite what I'm looking for.  I'm not using launchctl to set a startup/login item, I'm using it to allow the user to specify a schedule to perform various tasks based on a particular time and day of the week.  While I could write a login item which ran indefinitely and took care of the timing myself, it seems like I'd be reinventing the wheel!

I already moved from cron to launchd to support the AppStore, which was a pain, so I really hope Apple doesn't want me to roll my own timing mechanism just to support sandboxing!

Still, it's an option which I'll bear in mind, so thanks for that.

Mark


_______________________________________________

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

References: 
 >Sandboxing and calling Launchctl (From: Mark Allan <email@hidden>)
 >Re: Sandboxing and calling Launchctl (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Sandboxing and calling Launchctl
  • Next by Date: Re: Sandboxing and calling Launchctl
  • Previous by thread: Re: Sandboxing and calling Launchctl
  • Next by thread: Re: Sandboxing and calling Launchctl
  • Index(es):
    • Date
    • Thread