Re: Missing something about initialization
Re: Missing something about initialization
- Subject: Re: Missing something about initialization
- From: Scott Andrew <email@hidden>
- Date: Fri, 12 Jun 2009 11:27:59 -0700
A couple of things:
You are not retaining your values after retrieved (slot, svn, prn,
clock, block). These are auto released and will be released the the
next time the pool is cleaned up. (assuming you are not using garbage
collection). Not sure what your class is subclassed from, but if not
NSObject you want to a call to the super's init (or what ever the
designated initializer is).
Scott
On Jun 12, 2009, at 2:54 AM, Alfonso Ortega wrote:
I'm trying to parse a bit of html and use it to initialize an
object. I have very little background in objective-c, everything
parses correctly, I just can't seem to get the object initialized.
What am I doing wrong?
-(id)initWithNavcenRow:(NSString *)row
{
NSScanner *rowScanner = [NSScanner scannerWithString:row];
NSString *svnString;
NSString *prnString;
NSString *slotString;
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
capitalizedLetterCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&plane];
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
decimalDigitCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&slotString];
slot = [slotString intValue];
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
decimalDigitCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&svnString];
svn = [svnString intValue];
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
decimalDigitCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&prnString];
prn = [prnString intValue];
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
capitalizedLetterCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&block];
[rowScanner scanUpToCharactersFromSet:[NSCharacterSet
capitalizedLetterCharacterSet] intoString:NULL];
[rowScanner scanUpToString:@"</td>" intoString:&clock];
return self;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden