• 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
NSFileWrapper - is this really so bad?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileWrapper - is this really so bad?


  • Subject: NSFileWrapper - is this really so bad?
  • From: Graham Cox <email@hidden>
  • Date: Wed, 28 Oct 2015 10:24:53 +1100
  • X_v_e_cd: 7fcf138cc381c84e30c4179a14d19f9a
  • X_v_r_cd: 9cd66b37f0066b19d19ad0e8cd80f963

In XCode 7, I’m getting a new warning when compiling some code that uses NSFileWrapper, due to the addition of the NON_NULL qualifier:

Null passed to a callee that requires a non-null argument

The code is:

	NSFileWrapper* fw = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil];		//<—  Null passed to a callee that requires a non-null argument
	[fw setPreferredFilename:[self name]];
	[fw addRegularFileWithContents:content preferredFilename:kDKOLibraryItemDataFileName];

I’ve been doing this forever without any issue - create the directory file wrapper, then add regular files to it. The API design appears to condone this approach, even if it’s not spelt out anywhere. Now it seems we have to turn this all around and precreate the dictionary then create the enclosing directory wrapper.

While this change isn’t too hard, it seems like extra work and means going through old code that’s working fine, with the possiblity of creating bugs.

Has this approach always been bad, or is it a new thing? I’m all for tightening up sloppy coding, but could it be that in this case the non-null qualifier is in error?

—Graham



_______________________________________________

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


  • Follow-Ups:
    • Re: NSFileWrapper - is this really so bad?
      • From: Quincey Morris <email@hidden>
    • Re: NSFileWrapper - is this really so bad?
      • From: Graham Cox <email@hidden>
    • Re: NSFileWrapper - is this really so bad?
      • From: Greg Parker <email@hidden>
    • Re: NSFileWrapper - is this really so bad?
      • From: Rick Mann <email@hidden>
  • Prev by Date: Dictionary and Range
  • Next by Date: Re: NSFileWrapper - is this really so bad?
  • Previous by thread: Dictionary and Range
  • Next by thread: Re: NSFileWrapper - is this really so bad?
  • Index(es):
    • Date
    • Thread