Re: NSMutableArrya problems
Re: NSMutableArrya problems
- Subject: Re: NSMutableArrya problems
- From: Apirak <email@hidden>
- Date: Sat, 11 Dec 2004 12:40:02 +0700
my -setWord and -getWord work very well, but it will show me an error
after I get it from NSMutableArray.
Word *wd = [[myArray objectAtIndex:0] retain];
NSLog(@"word equal %@", [wa getWord]);
I think it because "retains or copies" problems that you said. // my
basic skill is java don't know much about vector :p
this is my -setWord and -getWord
NSString *word;
- (NSString *) getWord {
return word;
}
- (void) setWord:(NSString *)newword {
word = newword;
}
Thank you :)
Apirak Panatkool
e-mail: email@hidden
phone: 01-4033320
On Dec 11, 2004, at 11:35 AM, Brendan Younger wrote:
On Dec 10, 2004, at 10:14 PM, Apirak wrote:
I store my object (Word) in NSMutableArray. How do I get it back like
this
NSMutableArray *myArray = [[NSMutableArray alloc] init];
Word *word = [[Word alloc] init];
[word setWord:@"test"];
[myArray addObject:word];
Word *wd = [[myArray objectAtIndex:0] retain];
NSLog(@"word equal %@", [wa getWord]);
Which variable is "wa", you've assigned "wd" the value from the array.
Also, the retain is probably unnecessary. You should check that
-setWord: retains or copies its argument and that -getWord is
returning the correct object.
don't have any error in compile time but in run time it show this
message
XMLData has exited due to signal 10 (SIGBUS).
When you get this error, you've dereferenced an invalid pointer
somewhere.
I am very new to Obj-C and Cocoa, What happen with my code?
Brendan Younger
_______________________________________________
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