• 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: Can't create temporary file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't create temporary file


  • Subject: Re: Can't create temporary file
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 14 May 2011 12:53:37 -0500

On 14 May 2011, at 12:46 AM, Rick Mann wrote:

>    NSError* err = nil;
>    NSURL* tempDir = [fm URLForDirectory: NSItemReplacementDirectory
>                            inDomain: NSUserDomainMask
>                            appropriateForURL: inURL
>                            create: true
>                            error: &err];
>    if (err != nil)
>    {
>        NSLog(@"Error creating temporary directory for URL %@: %@", inURL, err);
>        return;
>    }

[similar check of err later in the code]

Quincey Morris identified your problem, but you can't do this. Methods that take NSError** are entitled to fill in the error return even if they succeed. Always check the principal return value (tempDir being nil, here) and _then_ you'll know that the NSError represents the actual description of a problem.


	— F

_______________________________________________

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: 
 >Can't create temporary file (From: Rick Mann <email@hidden>)

  • Prev by Date: NSPostWhenIdle not doing its job?
  • Next by Date: create an autorelease pool in the init-method and release it in the dealloc-method ..?
  • Previous by thread: Re: Can't create temporary file
  • Next by thread: Re: @property IBOutlet
  • Index(es):
    • Date
    • Thread