iphoneobjective-cmpmediaitemnszombieenabled

message sent to released object (never released manually)


Removed release statements. Some of them seemed to be okay, but that was probably just because other things were exploding first.


- (void)handleNowPlayingItemChanged:(id)notification {
    MPMediaItem *item = self.musicPlayer.nowPlayingItem;
    NSString *title = [item valueForProperty:MPMediaItemPropertyTitle];

    NSNumber *duration = [item
                         valueForProperty:MPMediaItemPropertyPlaybackDuration];
    float totalTime = [duration floatValue];
    progressSlider.maximumValue = totalTime;

    CGSize artworkImageViewSize = self.albumCover.bounds.size;
    MPMediaItemArtwork *artwork = [item valueForProperty:
                                                   MPMediaItemPropertyArtwork];
    if (artwork) {
        self.albumCover.image = [artwork imageWithSize:artworkImageViewSize];
    } else {
        self.albumCover.image = nil;
    }

    titleLabel.text = title;

    /*OpenEars stuff*/
}

In another question I mention the SQLite errors concerning artwork.

** Deleted error and details concerning NSZombieEnabled alert of call to released objects. **


Well don't I feel stupid. It was all memory management.
I put effort into not leaking anything, even in a temporary solution, and yet I did this...


Solution

  • In the code you provide I do not see any calls to retain, alloc/init, or some variation of copy. That means that you should not have a any calls to release in that method and that will be the cause of your crash. Make sure you are not over releasing in other methods and remember the basics of memory management.