开发者

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.a开发者_JS百科lbumCover.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...


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.


You're releasing title and artwork, but they're not yours. This will lead, soon or later, to a tentative to release an already deallocated object (from item's dealloc or somewhere else).


// [artwork release];

//[title release];

comment those since those are autoreleased object

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜