Tanner Silva
Tanner Silva

Reputation: 279

Memory Issues For Mac App

I am having an issue for the following method in my AppDelegate.

- (void)itemDiscovered:(PodcastShow *)show
{
    NSLog(@"%@", show);
    NSArray* newArray = [self.showArray arrayByAddingObject:show];
    self.showArray = (NSMutableArray*)newArray; //This line signals SIGABRT
}

I'm a fairly new with ARC and Objective-C in general. Obviously, there is a memory issue, but I don't know what I'm doing wrong. I've written a ton of code just like this and I've never come across an issue like this. Here is the showArray property:

@property (strong, nonatomic) NSMutableArray *showArray;

Any help would be greatly appreciated.

Upvotes: 1

Views: 59

Answers (2)

Matt S.
Matt S.

Reputation: 13773

Try [self.showArray addObjectsFromArray:newArray] or [self.showArray addObject:show].

Also be sure that you are creating the mutable array by calling self.showArray = [NSMutableArray array] (or something similar) somewhere in your code.

Upvotes: 1

danielbeard
danielbeard

Reputation: 9149

Why wouldn't you just add the new object to the showArray?

[self.showArray addObject: show];

Or am I missing something with the creation of the newArray?

Upvotes: 1

Related Questions