Re: bus error (newbie)
Re: bus error (newbie)
- Subject: Re: bus error (newbie)
- From: Frederick Cheung <email@hidden>
- Date: Tue, 8 Feb 2005 10:02:38 +0000
On 8 Feb 2005, at 09:56, Daniel Child wrote:
US ERROR OCCURS WHEN I TRY TO INIT THE OBJECT BELOW
[theSyllable initWithPinyin: [threeSyllables[2] stringForObjectValue]
bopomofo: [threeSyllables[1] stringForObjectValue]
wadegiles: [threeSyllables[0] stringForObjectValue]];
[syllables addObject: theSyllable];
count++;
}
If I remove stringForObjectValue, I get a message to the effect that I
am passing pointers from incompatible types (presumably because the
array (threeSyllables) contains objects and I need NSStrings to meet
the init requirements for theSyllable.
I know I am missing something incredibly obvious with respect to ways
to convert object -> NSString, but after mucking around for a while, I
still don't get it. Would appreciate the help!
2 things:
1) an NSArray is not a c array, you access values via [threeSyllables
objectAtIndex:index]
2) you are initing theSyllable without having called alloc first.
theSyllable is almost certainly pointing at junk or at an invalid
address.
Fred
_______________________________________________
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