FROM : j o a r
DATE : Sat Nov 02 17:50:17 2002
You are using a convenience method to construct the array, the
"arrayWithObjects:" method. This method returns an autoreleased array,
meaning that it will be deallocated automatically if you don't
explicitly retain it.
On Saturday, Nov 2, 2002, at 17:37 Europe/Stockholm, Dave Sopchak wrote:
> -(id) init
> {
> GuideStar* guideStar1 = [[GuideStar alloc] init];
> GuideStar* guideStar2 = [[GuideStar alloc] init];
> GuideStar* guideStar3 = [[GuideStar alloc] init];
>
> GuideStar* test;
>
> if (self = [super init])
> {
> guideStarArray = [NSArray arrayWithObjects: guideStar1,
> guideStar2, guideStar3, nil];
> [guideStar1 release];
> [guideStar2 release];
> [guideStar3 release];
> }
> }
This should work better:
- (id) init
{
self = [super init];
if (self != nil)
{
GuideStar* guideStar1 = [[GuideStar alloc] init];
GuideStar* guideStar2 = [[GuideStar alloc] init];
GuideStar* guideStar3 = [[GuideStar alloc] init];
guideStarArray = [[NSArray alloc] initWithObjects: guideStar1,
guideStar2, guideStar3, nil];
[guideStar1 release];
[guideStar2 release];
[guideStar3 release];
}
return self;
}
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sat Nov 02 17:50:17 2002
You are using a convenience method to construct the array, the
"arrayWithObjects:" method. This method returns an autoreleased array,
meaning that it will be deallocated automatically if you don't
explicitly retain it.
On Saturday, Nov 2, 2002, at 17:37 Europe/Stockholm, Dave Sopchak wrote:
> -(id) init
> {
> GuideStar* guideStar1 = [[GuideStar alloc] init];
> GuideStar* guideStar2 = [[GuideStar alloc] init];
> GuideStar* guideStar3 = [[GuideStar alloc] init];
>
> GuideStar* test;
>
> if (self = [super init])
> {
> guideStarArray = [NSArray arrayWithObjects: guideStar1,
> guideStar2, guideStar3, nil];
> [guideStar1 release];
> [guideStar2 release];
> [guideStar3 release];
> }
> }
This should work better:
- (id) init
{
self = [super init];
if (self != nil)
{
GuideStar* guideStar1 = [[GuideStar alloc] init];
GuideStar* guideStar2 = [[GuideStar alloc] init];
GuideStar* guideStar3 = [[GuideStar alloc] init];
guideStarArray = [[NSArray alloc] initWithObjects: guideStar1,
guideStar2, guideStar3, nil];
[guideStar1 release];
[guideStar2 release];
[guideStar3 release];
}
return self;
}
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Dave Sopchak | Nov 2, 17:37 | |
| j o a r | Nov 2, 17:50 | |
| Dave Sopchak | Nov 2, 17:56 | |
| j o a r | Nov 2, 18:01 |






Cocoa mail archive

