Memory Leak from NSMutableArray and NSDictionary - objective-c

I have a memomry leak problem, maybe somebody can help me.
I try to load an NSMutable array for a pList and show some elements in a TablevView
In the h.File I declare
#interface Bestellung : UIViewController <UITableViewDelegate, UITableViewDelegate> {
NSMutableArray *bestellteVorspeisen;
NSMutableArray *bestellteVorspeisenPreis;
NSMutableArray *bestellteVorspeisenDetails;
NSMutableArray *bestellteVorspeisenBild;
NSMutableArray *bestellteVorspeisenNummer;
NSMutableArray *bestellListe;
IBOutlet UITableView *myTable;
}
#property (nonatomic, retain) NSMutableArray *bestellListe;
#property (nonatomic,retain) NSMutableArray *bestellteVorspeisen;
#property (nonatomic,retain) NSMutableArray *bestellteVorspeisenPreis;
#property (nonatomic,retain) NSMutableArray *bestellteVorspeisenDetails;
#property (nonatomic,retain) NSMutableArray *bestellteVorspeisenBild;
#property (nonatomic,retain) NSMutableArray *bestellteVorspeisenNummer;
#end
In the M.File viewDidLoad I load the pList in bestellListe
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:#"Bestellung.plist"];
success = [fileManager fileExistsAtPath:filePath];
if (!success)
{
NSString *path = [[NSBundle mainBundle] pathForResource:#"Bestellung" ofType:#"plist"];
success = [fileManager copyItemAtPath:path toPath:filePath error:&error];
}
self.bestellListe = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
Then I generate the MutableArray
bestellteVorspeisen = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenPreis = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenDetails = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenBild = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenNummer = [[NSMutableArray alloc] initWithCapacity:1];
Afterwards I fill them from bestellListe
for (NSDictionary *bestellDict in bestellListe)
{ if ([[bestellDict objectForKey:#"Tisch"] isEqualToString:
[NSString stringWithFormat:#"%i",TischNummer]])
{if ([[bestellDict objectForKey: kBestellungKategorieString] isEqualToString: #"Vorspeise"])
[bestellteVorspeisen addObject: [bestellDict objectForKey:kBestellungNameString]];
[bestellteVorspeisenPreis addObject: [bestellDict objectForKey:kBestellungPreisString]];
[bestellteVorspeisenDetails addObject: [bestellDict objectForKey:kBestellungDetailString]];
[bestellteVorspeisenBild addObject: [bestellDict objectForKey:kBestellungBildString]];
[bestellteVorspeisenNummer addObject: [bestellDict objectForKey:kBestellungNummer]];
} // if
} // if
} // for
This causes memoryleaks at
self.bestellListe = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
and
bestellteVorspeisen = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenPreis = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenDetails = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenBild = [[NSMutableArray alloc] initWithCapacity:1];
bestellteVorspeisenNummer = [[NSMutableArray alloc] initWithCapacity:1];
Here ist dealloc
- (void)dealloc {
NSLog(#"Bestellung dealloziert");
[bestellteVorspeisen release];
[bestellteVorspeisenPreis release];
[bestellteVorspeisenDetails release];
[bestellteVorspeisenBild release];
[bestellteVorspeisenNummer release];
[bestellListe release];
[myTable release];
[super dealloc];
Can somebody give me some help, I'm really new in that.

your property synthesized method automatically retains received objects :
#property (nonatomic, retain) NSMutableArray *bestellListe;
So when you do :
self.bestellListe = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
Your bestellListe has a retain count of 2 (the alloc + the retain from the property).
On your dealloc you only release it once :
[bestellListe release];
The simpler solution seems to retain it only once when creating it, with an autoreleased initializer like :
self.bestellListe = [NSMutableArray arrayWithContentsOfFile:filePath];
Hope this can help

Related

Encode NSMutableArray

EDIT: Ok i decided to save the array in the userDefaults... should be easy, right ?
Save:
NSUserDefaults *userDefs = [NSUserDefaults standardUserDefaults];
[userDefs setObject:videoArray forKey:#"dataArray"];
[userDefs synchronize];
Load:
NSUserDefaults *userDefs = [NSUserDefaults standardUserDefaults];
videoArray = [[NSUserDefaults standardUserDefaults] mutableArrayValueForKey:#"dataArray"];
[tableview reloadData];
NSLog(#"%#",videoArray);
Class of the objects which are in the array:
#interface DEVideoModel : NSObject
#property (copy) NSString *name;
#property (copy) NSImage *thumbnail;
#property (copy) NSDictionary *qualities;
#property (readwrite) float videoSize;
#property (readwrite) float progress;
#property (copy) NSString *filePath;
#property (copy) NSDate *datum;
#end
#synthesize name,filePath,videoSize,qualities,thumbnail,datum,progress;
-(id)init {
self = [super init];
if(self) {
qualities = [[NSDictionary alloc]init];
thumbnail = [[NSImage alloc]init];
}
return self;
}
#end
And my videoArray is (null) when i load it ?! I don't get it. videoArray is a NSMutableArray not NSArray by the way.
IN your code you are writting NSData to NSCoder, so you need to read NSData then convert it to Array.
NSURL *appSupportDir = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&error];
NSString *path = [NSString stringWithFormat:#"%#/DEConvert.dat",[appSupportDir path]];
NSLog(#"%#",appSupportDir);
NSData *data = [NSData dataWithContentsOfFile:path];
NSMutableArray *arr = [NSKeyedUnarchiver unarchiveObjectWithData:data];
to store object in NSUserDefault
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:#"your key"];
Unarchiving is just as easy:
NSData *NewData = [[NSUserDefaults standardUserDefaults] objectForKey:#"your key"];
NSArray *arr = [NSKeyedUnarchiver unarchiveObjectWithData:NewData];

Saving to plist file issue

I can't save my new data to plist file for some reason. This is code I have been using for saving data:
-(void)saveData:(NSMutableDictionary *)dictionaryData toFile:(NSString *)filename {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];
NSString *path = [docDir stringByAppendingPathComponent:filename];
NSMutableArray *data = [[NSMutableArray alloc] initWithContentsOfFile:path];
[data addObject:dictionaryData];
[data writeToFile:filename atomically:YES];
}
this is code I used to copy file from bundle to app directory in case if it is not there :
-(NSMutableArray *)loadFromFile:(NSString *)filename {
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];
NSString *path = [docDir stringByAppendingPathComponent:filename];
NSFileManager *fileMgr = [NSFileManager defaultManager];
if(![fileMgr fileExistsAtPath:path]) {
NSArray *fileArray = [filename componentsSeparatedByString:#"."];
NSString *name = [fileArray objectAtIndex:0];
NSString *ext = [fileArray objectAtIndex:1];
NSString *bundle = [[NSBundle mainBundle] pathForResource:name ofType:ext];
[fileMgr copyItemAtPath:bundle toPath:path error:&error];
}
NSMutableArray *data = [[NSMutableArray alloc] initWithContentsOfFile:path];
return data;
}
For some reason I can't save new data to plist file. When I try to add new NSMutableDictionary object to my plist file (with saveData:toFile: method) and than reload my array variable with the plist file data - new object is not there. Am I doing something wrong?
this is how I load plist file :
#property (nonatomic, strong) NSMutableArray *modules;
#property (nonatomic, strong) NSMutableDictionary *module;
- (void)viewDidLoad {
[super viewDidLoad];
self.modules = [self loadFromFile:#"ModulesList.plist"];
self.module = [self.modules objectAtIndex:0];
for (int i = 0; i < self.modules.count; i++ ) {
NSLog(#"Modules array from plist file, module at index %i : %#",i, [self.modules objectAtIndex:i]);
}
than for testing purpose I have this code to add new module object:
- (IBAction)leftButton:(id)sender {
NSString *mytitle = [[NSString alloc] initWithFormat:#"my title"];
NSString *myauthor = [[NSString alloc] initWithFormat:#"my author2"];
NSUInteger myean = 22023423;
NSString *mytitle2 = [[NSString alloc] initWithFormat:#"my title 2"];
NSString *myauthor2 = [[NSString alloc] initWithFormat:#"my author2"];
NSUInteger myean2 = 29032432;
NSString *mytitle3 = [[NSString alloc] initWithFormat:#"my title 3"];
NSString *myauthor3 = [[NSString alloc] initWithFormat:#"my author 3"];
NSUInteger myean3 = 21023423;
NSMutableDictionary *mybook = [[NSMutableDictionary alloc] init];
NSMutableDictionary *mybook2 = [[NSMutableDictionary alloc] init];
NSMutableDictionary *mybook3 = [[NSMutableDictionary alloc] init];
[mybook setObject:mytitle forKey:#"title"];
[mybook setObject:myauthor forKey:#"author"];
[mybook setObject:[NSNumber numberWithInteger:myean] forKey:#"ean"];
[mybook2 setObject:mytitle2 forKey:#"title"];
[mybook2 setObject:myauthor2 forKey:#"author"];
[mybook2 setObject:[NSNumber numberWithInteger:myean2] forKey:#"ean"];
[mybook3 setObject:mytitle3 forKey:#"title"];
[mybook3 setObject:myauthor3 forKey:#"author"];
[mybook3 setObject:[NSNumber numberWithInteger:myean3] forKey:#"ean"];
NSMutableArray *mybooks = [[NSMutableArray alloc] init];
[mybooks addObject:mybook];
[mybooks addObject:mybook2];
[mybooks addObject:mybook3];
[self.module setObject:mybooks forKey:#"books"];
[self.modules addObject:self.module];
for (int i = 0; i < self.modules.count; i++ ) {
NSLog(#"Modules array after add operation, module at index: %i: %#",i, [self.modules objectAtIndex:i]);
}
[self saveData:self.module toFile:#"ModulesList.plist"];
}
than when I will reload my self.modules array from plist with button action, my new data is not there:
- (IBAction)reload:(id)sender {
self.modules = [self loadFromFile:#"ModulesList.plist"];
for (int i = 0; i < self.modules.count; i++ ) {
NSLog(#"RELOAD: Modules array from plist file, module at index %i : %#",i,[self.modules objectAtIndex:i]);
}
}
this is screenshot of my plist file : http://dl.dropbox.com/u/49076351/Screen%20Shot%202013-02-27%20at%2016.27.45.png

XML Parsing Class Leaking Strings on Rerun

I've been at this issue for two days, and no matter what I do, I cannot get it to stop leaking strings.
The class is a XML parser (using TouchXML), that is designed to run repeatedly throughout the life time of the application. The first time it runs, there are no leaks, everything cleans up perfectly. On the second run, it begins to leaks, almost always where ever strings are.
Some images from Instruments:
http://www.producerstudio.net/1.png
http://www.producerstudio.net/2.png
.h
#import <Foundation/Foundation.h>
#import "TouchXML.h"
#protocol RSSParsingComplete
-(void)parsingFinished;
#end
#interface RSS : NSObject<NSXMLParserDelegate>{
NSArray *rssURLArray;
NSMutableData *xmlData;
NSMutableArray *articles;
NSMutableArray *arrayOfArticles;
int numberOfFeeds;
NSDateFormatter *inputFormatter;
NSDateFormatter *outputFormatter;
id<RSSParsingComplete> delegate;
}
#property (nonatomic, retain) NSArray *rssURLArray;
#property (nonatomic, retain) NSMutableData *xmlData;
#property (nonatomic, retain) id<RSSParsingComplete> delegate;
#property (nonatomic, retain) NSMutableArray *articles;
#property (nonatomic, retain) NSMutableArray *arrayOfArticles;
#property (nonatomic, retain) NSDateFormatter *inputFormatter;
#property (nonatomic, retain) NSDateFormatter *outputFormatter;
-(id)initWithRSSArray:(NSArray *)inputURLArray;
-(void)connect;
-(NSArray *)feedArticles;
#end
.m
#import "RSS.h"
#implementation RSS
#synthesize xmlData, rssURLArray, articles, arrayOfArticles, delegate, inputFormatter, outputFormatter;
-(void)connect{
self.xmlData = [[[NSMutableData alloc] init] autorelease];
NSURL *rssURL = [[NSURL alloc] initWithString:[self.rssURLArray objectAtIndex:numberOfFeeds-1]];
NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:rssURL] delegate:self];
[urlConnection release];
[rssURL release];
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
[self.xmlData setLength:0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
[self.xmlData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
[xmlData release];
[connection release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
CXMLDocument *xmlDoc = [[[CXMLDocument alloc] initWithData:xmlData options:0 error:nil] autorelease];
self.articles = [[[NSMutableArray alloc] init] autorelease];
self.inputFormatter = [[[NSDateFormatter alloc] init] autorelease];
self.outputFormatter = [[[NSDateFormatter alloc] init] autorelease];
[self.inputFormatter setDateFormat:#"EEE, dd MMM yyyy HH:mm:ss zzz"];
[self.inputFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:#"en_US_POSIX"] autorelease]];
[self.inputFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:#"UTC"]];
[self.outputFormatter setDateFormat:#"dd.MM.yyyy HH:mm:ss"];
[self.outputFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:#"en_US_POSIX"] autorelease]];
[self.outputFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:#"UTC"]];
NSArray *itemNodes = [xmlDoc nodesForXPath:#"//item" error:nil];
for(CXMLElement *node in itemNodes){
NSMutableDictionary *article = [[NSMutableDictionary alloc] init];
for(int counter = 0; counter < [node childCount]; counter++){
if([[[node childAtIndex:counter] name] isEqualToString:#"title"]){
[article setObject:[[node childAtIndex:counter] stringValue] forKey:#"title"];
}
if([[[node childAtIndex:counter] name] isEqualToString:#"link"]){
[article setObject:[[node childAtIndex:counter] stringValue] forKey:#"url"];
}
if([[[node childAtIndex:counter] name] isEqualToString:#"description"]){
[article setObject:[[node childAtIndex:counter] stringValue] forKey:#"description"];
}
if([[[node childAtIndex:counter] name] isEqualToString:#"pubDate"]){
NSDate *tempDate = [self.inputFormatter dateFromString:[[node childAtIndex:counter] stringValue]];
[article setObject:[self.outputFormatter stringFromDate:tempDate] forKey:#"name"];
}
}
[self.articles addObject:article];
[article release];
}
NSArray *feedTitleNode = [xmlDoc nodesForXPath:#"//title" error:nil];
NSString *feedTitle = [[NSString alloc] initWithString:[[[feedTitleNode objectAtIndex:0] childAtIndex:0] stringValue]];
[self.articles addObject:feedTitle];
[feedTitle release];
[self.arrayOfArticles addObject:[articles copy]];
[self.articles removeAllObjects];
[inputFormatter release];
[outputFormatter release];
numberOfFeeds--;
if(numberOfFeeds > 0){
[self connect];
}else{
[delegate parsingFinished];
}
}
-(NSArray *)feedArticles{
NSLog(#"Array of Articles: %#", self.arrayOfArticles);
return self.arrayOfArticles;
}
-(id)initWithRSSArray:(NSArray *)inputURLArray{
self = [super init];
if (self) {
self.arrayOfArticles = [[[NSMutableArray alloc] init] autorelease];
self.rssURLArray = [[[NSArray alloc] initWithArray:inputURLArray] autorelease];
numberOfFeeds = [self.rssURLArray count];
[self connect];
}
return self;
}
-(void)dealloc{
[rssURLArray release];
[xmlData release];
[articles release];
[arrayOfArticles release];
[super dealloc];
}
- (id)init
{
self = [super init];
return self;
}
#end
I've done everything I can think of to resolve the leaks. I've read the Apple Memory Management guides, as well as the excellent guide on iPhoneDevSDK and that has helped me cut down on 90% of the leaks I originally had (the class doesn't leak so long as you call it once). Maybe i've been staring at this for too long, or maybe i'm missing something obvious.
I appreciate it!
First, should delegate be retained? I'm not sure why you need it as an instance variable at all. But since it's retained (and you don't seem to release it), your RSS object will retain a circular reference to itself and won't ever be released.
Second, do you need to keep the date formatters in an instance variable? It looks like you're allocating them and releasing them in the same method. Note that they're retained in the RSS instance and never released.

memory leak and instance variables

-(void) getAccounts {
self.selAccounts = [[NSMutableArray alloc] init];
self.accounts = [[NSMutableArray alloc] init];
NSString *url=[NSString stringWithFormat:#"https://localhost//listaccts"];
self.processor=[[AsynConnectionProcessorController alloc] init];
self.processor.delegate=self;
self.processor.server=self.server;
[processor createRequestfromURL:url];
}
This method is causing memory leak when invoked. Now if I replace this with below
-(void) getAccounts {
[accounts release];
self.selAccounts = [[NSMutableArray alloc] init];
accounts = [[NSMutableArray alloc] init];
NSString *url=[NSString stringWithFormat:#"https://localhost//listaccts"];
self.processor=[[AsynConnectionProcessorController alloc] init];
self.processor.delegate=self;
self.processor.server=self.server;
[processor createRequestfromURL:url];
}
I am getting memory leak if I invoke this method second time as a result of viewcontroller beong popped from stack.
Why does this leak? accounts is an insyance variable with declration like this :
#property (nonatomic, retain) NSMutableArray *accounts;
Can't I assume that there won't be memory leak if I use setter via self.accounts?
This is wrong
self.accounts = [[NSMutableArray alloc] init];
the setter already does a retain, since you specified that in the property
#property (nonatomic, retain) NSMutableArray *accounts;
you should rewrite it like this
NSMutableArray arr = [[NSMutableArray alloc] init];
self.accounts = arr;
[arr release];
or alternatively:
self.accounts = [[[NSMutableArray alloc] init] autorelease];
EDIT: removed 'non preferred' - was subjective.

objective-c cant find memory leak

im mapping an xml on a custom nsobject.
when the user hits reload the function is called again.
i get several memory leaks on all strings:
UPDATE this is the current code.
- (void)mapDataOnModel
{
if(mixesArr != nil)
{
//[mixesArr release];
[mixesArr removeAllObjects];
[playListArr removeAllObjects];
}
else
{
mixesArr = [[NSMutableArray alloc]init];
playListArr = [[NSMutableArray alloc] init];
}
MixVO *tmpMix;
AudioVO *tmpAudio;
for (DDXMLElement *node in nodes)
{
tmpMix = [[MixVO alloc] init];
tmpMix.uuid = [[node attributeForName:#"uuid"] stringValue];
tmpMix.name = [[[node elementsForName:#"name"] objectAtIndex:0] stringValue];
tmpMix.artist = [[[node elementsForName:#"artist"] objectAtIndex:0] stringValue];
tmpMix.path = [[[node elementsForName:#"file"] objectAtIndex:0] stringValue];
tmpMix.headline = [[[node elementsForName:#"headline"] objectAtIndex:0] stringValue];
tmpMix.teaser = [[[node elementsForName:#"teaser"] objectAtIndex:0] stringValue];
tmpMix.copy = [[[node elementsForName:#"copy"] objectAtIndex:0] stringValue];
tmpMix.isHighlight = NO;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:#"HH:mm:ss"];
tmpMix.duration = [dateFormat dateFromString:[[[node elementsForName:#"duration"] objectAtIndex:0] stringValue]] ;
[dateFormat release];
// CHECK IF IT IS A HIGHLIGHT MIX
for (int i = 0; i < [[highlightsNode elementsForName:#"member"] count]; i++)
{
NSString *highlightID;
highlightID = [[[highlightsNode elementsForName:#"member"] objectAtIndex:i] stringValue] ;
if([tmpMix.uuid isEqualToString:highlightID])
{
tmpMix.isHighlight = YES;
}
}
if([[node elementsForName:#"image_standard"] count] > 0)
tmpMix.image_standard = [[[node elementsForName:#"image_standard"] objectAtIndex:0] stringValue] ;
if([[node elementsForName:#"image_artist"] count] > 0)
tmpMix.image_artist = [[[node elementsForName:#"image_artist"] objectAtIndex:0] stringValue] ;
if([[node elementsForName:#"image_teaser"] count] > 0)
tmpMix.image_teaser = [[[node elementsForName:#"image_teaser"] objectAtIndex:0] stringValue] ;
if([[node elementsForName:#"image_player"] count] > 0)
tmpMix.image_player = [[[node elementsForName:#"image_player"] objectAtIndex:0] stringValue] ;
/*
tmpAudio = [[AudioVO alloc] init];
tmpAudio.file = tmpMix.path;
NSString *tmpDuration;
tmpDuration = [[[node elementsForName:#"duration"] objectAtIndex:0] stringValue];
tmpAudio.duration = tmpDuration;
// PARSE TRACKS
NSArray *track = NULL;
track = [node elementsForName:#"tracks"];
DDXMLElement *trackElems = [track objectAtIndex:0];
NSArray *tracks = NULL;
tracks = [trackElems elementsForName:#"track"];
NSMutableArray *tracksArray;
tracksArray = [[NSMutableArray alloc]init];
TrackVO *tmpTrack;
for (DDXMLElement *node2 in tracks)
{
tmpTrack = [[TrackVO alloc] init];
tmpTrack.timecode = [[node2 attributeForName:#"timecode"] stringValue];
tmpTrack.name = [node2 stringValue];
[tracksArray addObject:tmpTrack];
[tmpTrack release];
}
tmpAudio.tracksArr = tracksArray;
[tracksArray release];
tmpMix.audioVO = tmpAudio;
[tmpAudio release];
*/
[mixesArr addObject:tmpMix];
[tmpMix release];
}
// SORT PROGRAMM
/*
NSSortDescriptor *lastDescriptor =
[[[NSSortDescriptor alloc]
initWithKey:#"artist"
ascending:YES
selector:#selector(localizedCaseInsensitiveCompare:)] autorelease];
NSArray * descriptors =
[NSArray arrayWithObjects:lastDescriptor, nil];
NSArray * sortedArray = [mixesArr sortedArrayUsingDescriptors:descriptors];
//[mixesArr release];
mixesArr = [[NSMutableArray alloc]initWithArray:sortedArray];
// PARSE PLAYLIST
for (DDXMLElement *node in nodesPl)
{
SchedVO *tmpSched;
tmpSched = [[SchedVO alloc] init];
NSString *timeStr;
timeStr = [[node attributeForName:#"timestamp"] stringValue];
tmpSched.date = [NSDate dateWithTimeIntervalSince1970:timeStr.intValue];
tmpSched.uid = [node stringValue];
[playListArr addObject:tmpSched];
//[tmpSched release];
}
*/
[self updateDone];
}
MixVO:
#interface MixVO : NSObject
{
NSString *uuid;
NSString *name;
NSString *artist;
NSString *path;
NSString *headline;
NSString *teaser;
NSString *copy;
NSString *image_standard;
NSString *image_artist;
NSString *image_teaser;
NSString *image_player;
NSDate *duration;
AudioVO *audioVO;
BOOL isHighlight;
}
#property (nonatomic,retain) NSString *uuid;
#property (nonatomic,retain) NSString *name;
#property (nonatomic,retain) NSString *artist;
#property (nonatomic,retain) NSString *path;
#property (nonatomic,retain) NSString *headline;
#property (nonatomic,retain) NSString *teaser;
#property (nonatomic,retain) NSString *copy;
#property (nonatomic,retain) NSString *image_standard;
#property (nonatomic,retain) NSString *image_artist;
#property (nonatomic,retain) NSString *image_teaser;
#property (nonatomic,retain) NSString *image_player;
#property (nonatomic,retain) NSDate *duration;
#property (nonatomic,retain) AudioVO *audioVO;
#property BOOL isHighlight;
#end
maybe someone can help me with this.
thanks in advance
alex
if(mixesArr != nil)
{
[mixesArr removeAllObjects];
[playListArr removeAllObjects];
}
mixesArr = [[NSMutableArray alloc]init];
This suggest mixesArr could already be allocated, and you simply allocate a new instance, making the original mixesArr a dangling pointer.
Shouldn't you write something like:
if(mixesArr != nil)
{
[mixesArr removeAllObjects];
[playListArr removeAllObjects];
}
else {
mixesArr = [[NSMutableArray alloc]init];
}
Or something similar?
Where are you releasing mixesArr?
You'll also want to release all the strings you're retaining.