RE: NSMutableArray won't tell me its count !
RE: NSMutableArray won't tell me its count !
- Subject: RE: NSMutableArray won't tell me its count !
- From: Oliver Donald <email@hidden>
- Date: Tue, 13 Dec 2005 11:46:38 -0000
Hi,
NSLog(@"%@",[myMutableArray count]);
That NSLog() line tells NSLog uses the %@ formatter, telling NSLog to expect
an object, but [myMutableArray count] returns an integer. This causes a
crash, rather than just a wierd value, because the runtime uses the 'count'
as if it where an object's address, and tries to call it's 'description'
method. ObjC deals fine with sending messages to NULL, but not to invalid
objects!
Cheers,
Oli
-----Original Message-----
From: Martin [
mailto:email@hidden]
Sent: 13 December 2005 11:38
To: CocoaDev list
Subject: NSMutableArray won't tell me its count !
Hi,
My code that looks like :
-(void)myFunction {
NSLog(@"%@",myMutableArray);
NSLog(@"%@",[myMutableArray count]);
}
And, when I call the function, the first line goes ok (myMutableArray
is correctely logged) but there's a problem with the second line, the
debugger launches itself and returns :
Error from debugger, executable path is nil
MyApp has exited due to signal 10 (SIGBUS)
What is weird is that, even if I can "Build and run" my application,
"Build and debug" won't work, the debugger still says "Error from
debugger, executable path is nil". A search "executable path is nil"
on Google produces only 1 result which doesn't help.
The thing that I don't undersand is, why can the program log the
entire array (I see the result with my eyes ! I hope I am not
crazy !) and can't get its count ?
Any clues ?
Thanks,
Martin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
DISCLAIMER: The information contained in this e-mail is confidential and may
be privileged. It is intended for the addressee only. If you are not the
intended recipient, please delete this e-mail immediately. The contents of
this email must not be disclosed or copied without the sender's consent. We
cannot accept any responsibility for viruses, so please scan all
attachments. The statements and opinions expressed in this message are those
of the author and do not necessarily reflect those of the company. The
company does not take any responsibility for the views of the author.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden