• 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
Sandboxing problems: writing to a temporary directory is not allowed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sandboxing problems: writing to a temporary directory is not allowed


  • Subject: Sandboxing problems: writing to a temporary directory is not allowed
  • From: Nick <email@hidden>
  • Date: Sat, 15 Sep 2012 01:19:16 +0300

Hello

I am writing a simple Mail.app plugin that is intended for exporting
emails in a custom format.
Now, the problem is that I used to save email files into a temporary
directory (NSTempDirectory()) before converting them.
It worked fine on 10.6 and 10.7, but on OS X 10.8, everytime I try to
write anything from within a Mail.app plugin (plugins operate on
behalf of Mail.app itself) to /private/var/tmp I am getting a "You do
not have permissions" error. I suppose this is because Mail on
Mountain Lion became sandboxed.

I thought I found a solution to write to /tmp, using this  function:
NSString *TempDir = [[[NSFileManager defaultManager]
URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask
appropriateForURL:[NSURL
URLWithString:@"file:///private/var/tmp/mytempdir"] create:YES
error:nil] path];

but everytime i try to write to TempDir, i still get this "No
permission" error. Even though the directory, whose path is in TempDir
(/private/var/folders/68/qm5hjswj1gjc5_5ngpdjkh8c0000gn/T/com.apple.mail/TemporaryItems/(A
Document Being Saved By Mail)) is allowed for writing for an ordinary
user.

Why can't I write there programmatically then?..

Thanks!
_______________________________________________

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

  • Prev by Date: Re: Sandboxing not so bad
  • Next by Date: Re: Another sandboxing snafu
  • Previous by thread: Re: NSNumberFormatter + nil values
  • Next by thread: Cannot get to bugreporter.apple.com from Safari 6.0.
  • Index(es):
    • Date
    • Thread