• 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: warning:assignment from distinct Objective-C type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warning:assignment from distinct Objective-C type


  • Subject: Re: warning:assignment from distinct Objective-C type
  • From: David Blanton <email@hidden>
  • Date: Wed, 1 Jul 2009 10:56:03 -0600

Thanks Ken ...  got it right now!

On Jul 1, 2009, at 10:34 AM, Ken Thomases wrote:

On Jul 1, 2009, at 11:26 AM, David Blanton wrote:

	in .h file


NSMutableArray *m_sources;

[...]

m_sources = [volumes stringsByAppendingPaths:[defaultManager directoryContentsAtPath:volumes]];

-stringsByAppendingPaths: returns an NSArray*. That is not an NSMutableArray*. (NSMutableArray is-a NSArray, though, of course.)


By assigning to m_sources, you're "threatening" to invoke mutation methods on the object. This would be a violation of the type system, and so the compiler warns you about it.

Regards,
Ken




_______________________________________________

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: 
 >warning:assignment from distinct Objective-C type (From: David Blanton <email@hidden>)
 >Re: warning:assignment from distinct Objective-C type (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSObjectController, content outlet and content object question
  • Next by Date: Re: How Do I Statically Link to libcurl?
  • Previous by thread: Re: warning:assignment from distinct Objective-C type
  • Next by thread: Re: warning:assignment from distinct Objective-C type
  • Index(es):
    • Date
    • Thread