Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

use of undeclared identifier 'didreceivememorywarning'

I'm getting the above message on my build a playlist Browser with Objective - C but I have no idea how to fix it.

#import "PlaylistMasterViewController.h"
#import "PlaylistDetailViewController.h"
#import "Playlist.h"

@interface PlaylistMasterViewController ()
@end
@implementation PlaylistMasterViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    for (NSUInteger index = 0; index < self.playlistImageViews.count; index++) {

        Playlist *playlist = [[Playlist alloc] initWithIndex: index];

        UIImageView *playlistImageView = self.playlistImageViews[index];

        playlistImageView.image = playlist.playlistIcon;
        playlistImageView.backgroundColor = playlist.backgroundColor;
}

1 Answer

Michael Hulet
Michael Hulet
47,893 Points

Somewhere in your project (though I don't see it in this snippet), you tried to call the method "didreceivememorywarning" without defining it. My bet is that you were trying to define the "didReceiveMemoryWarning" method somewhere, and did something like this:

-(void)didreceivememorywarning{
    //This line would cause a problem
    [super didreceivememorywarning];

    //You might have other code down here
}

This would be a version of that method that wouldn't cause a problem:

//Notice the capitalization
-(void)didReceiveMemoryWarning{
    //This wouldn't cause a problem
    [super didReceiveMemoryWarning];

    //You can put other code down here, too
}