• 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: No sure way to tell whether an array is mutable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No sure way to tell whether an array is mutable?


  • Subject: Re: No sure way to tell whether an array is mutable?
  • From: "R. Matthew Emerson" <email@hidden>
  • Date: Thu, 25 Jan 2007 21:45:16 -0500


On Jan 25, 2007, at 9:37 PM, R. Matthew Emerson wrote:

Instead, you might be able to use something like

if ([newChildren respondsToSelector:@selector (insertObject:atIndex:)]) { ... }

Sorry everyone. I should have tested before speculating. This won't work.


#include <Foundation/Foundation.h>

main()
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSArray *array = [NSArray arrayWithObject:@"foo"];

    if ([array respondsToSelector:@selector(insertObject:atIndex:)]) {
        NSLog(@"seems mutable");
    }
   [pool release];
}

When run, this yields
2007-01-25 21:44:17.636 a.out[1332] seems mutable






_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >No sure way to tell whether an array is mutable? (From: Kenny Leung <email@hidden>)
 >Re: No sure way to tell whether an array is mutable? (From: "R. Matthew Emerson" <email@hidden>)

  • Prev by Date: Re: No sure way to tell whether an array is mutable?
  • Next by Date: Re: No sure way to tell whether an array is mutable?
  • Previous by thread: Re: No sure way to tell whether an array is mutable?
  • Next by thread: Re: No sure way to tell whether an array is mutable?
  • Index(es):
    • Date
    • Thread