Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shilpa

macrumors member
Original poster
Hi all,
in my app i have created static instance of catalog object.
+(Catalog *)getCatalogObject
{
if(staticCatalogObj == nil)
{
staticCatalogObj = [[Catalog alloc]init];
staticCatalogObj.catalogDictionary = [[NSMutableDictionary alloc] init];
staticCatalogObj.itemsArray = [[NSMutableArray alloc]init];

}
return staticCatalogObj;
}
how to release this catalog object now.

also if any class has property then do we need to release them,or only if we release the instance is fine.for ex

@interface items : NSObject {
NSString *productID;
NSString *vendorID;
NSString *itemPrice;
NSString *itemName;
NSString *itemDescrioption;
NSString *smallImage;
NSString *bigImage;
NSInteger quantity;
}
@property(nonatomic)NSInteger quantity;
@property(nonatomic,copy)NSString *productID;
@property(nonatomic,copy)NSString *vendorID;
@property(nonatomic,copy)NSString *itemPrice;
@property(nonatomic,copy)NSString *itemName;
@property(nonatomic,copy)NSString *itemDescrioption;
@property(nonatomic,copy)NSString *smallImage;
@property(nonatomic,copy)NSString *bigImage;

items *itemObject = [[items alloc]init];
itemObject.productID = @"565";

then do i need to do
[itemObject.productID release];

i have not writen dealloc function for this class.
 
You need to hold onto a reference for that allocated object somewhere, probably in your application controller object. Then you can call release on it (or do it through the accessor). I'm assuming you're not using garbage collection...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.