Why my object becomes invalid ?
Why my object becomes invalid ?
- Subject: Why my object becomes invalid ?
- From: "kubernan @ 10191 Tec." <email@hidden>
- Date: Sat, 9 Aug 2003 03:09:40 +0200
Hello,
I read again and again the retain/release rules but i always have a
"strange"
behavior that causes a crash (signal 10).
In the -(id)init method of my main class i allocate a string :
(not compiled code)
@interface myClass : NSObject
{
NSString *myString
}
-(id)init
{
self= [super init];
myString = [[NSString alloc] init];
myString = [myString stringByAppendingString:@"test"];
return self;
}
-(void)myTestMethod
{
// the first time this method is called there is no problem
// with the second call, i have a crash on myString object
// there is no manipulation on myString between the first and second
call
NSLog([myDict objectForKey:@"theKey"]); // <- always gives something
NSLog(myString); // first time is OK, second call --> crash
[anOtherClass doSomethingWithTheParameter:[myString
stringByAppendingString:[myDict objectForKey:@"theKey"]]];
}
Is it possible that [myString stringByAppendingString:[myDict
objectForKey:@"theKey"]] as argument of the method
of anOtherClass makes something on myString object itself ?
Thx for your help.
K.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.