• 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: NSMutableArray count causes EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray count causes EXC_BAD_ACCESS


  • Subject: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • From: Christiaan Hofman <email@hidden>
  • Date: Mon, 16 Aug 2010 00:22:09 +0200

On Aug 16, 2010, at 0:12, Andrew Gehring wrote:

> I'm new to XCode /Obj-c, so please forgive my my transgressions...
>
> I have 'NSMutableArray *members;'
>
> I load the array with XML data:
>
>        members = [[NSMutableArray alloc] init];
> 	NSArray *memberElements = [doc nodesForXPath:@"//member/value/string"
> error:&error];
> 	for (NSXMLElement *xmlElement in memberElements)
> 		[members addObject:[xmlElement stringValue]];
>
> I can "Log" the array, and it contains the expected data:
>
> 	NSLog(@"Members: %@", members);
>
> But when I try to count, I get a EXC_BAD_ACCESS
>
> 	NSLog(@"Count: %@", [members count]);
>
>
> Any help would be appreciated.
>
> Andrew

You're using the wrong string format specifier %@, which will interpret the count as a pointer to an object, and the object pointed to by that arbitrary number will almost certainly not exist.

Christiaan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSMutableArray count causes EXC_BAD_ACCESS (From: Andrew Gehring <email@hidden>)

  • Prev by Date: NSMutableArray count causes EXC_BAD_ACCESS
  • Next by Date: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Previous by thread: NSMutableArray count causes EXC_BAD_ACCESS
  • Next by thread: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread