Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Self Destructing App - Viewing sent image file


I have a problem displaying the image file when i click on the sender in Inbox. First of all, Xcode was giving me an error when i used a code as shown in the video. "NSURL *imageFileUrl =[ [NSURL alloc] initWithString: imageFile.url]; " so I replaced it with: "NSURL *imageFileUrl = [NSURL URLWithString:imageFile.url];". That worked for the error, but still there is no image retrieved from the Parse.com, but rather blank page appears, and instead of "Sent from 'sender'", I get "Sent from (null)" in the header. Im guessing there is a problem with communication with Parse.com, but the number of contacts and messages on Parse.com is updated whenever I do something with the app.

Any suggestions? Thanks all

2 Answers

Michael Reining
Michael Reining
10,101 Points

Everything worked for me when I followed the instructions. Did you manage to solve your problem? If not, perhaps it might help to copy and paste the entire viewDidLoad method. It could be that the mistake is caused by an error or typo in one of the other items.

Here is what I wrote down and it's working on my iPhone when I run the app.

- (void)viewDidLoad
    [super viewDidLoad];
    PFFile *imageFile = [self.message objectForKey:@"file"];
    NSURL *imageFileUrl = [[NSURL alloc] initWithString:imageFile.url];
    NSData *imageData = [NSData dataWithContentsOfURL:imageFileUrl];
    self.imageView.image = [UIImage imageWithData:imageData];
    NSString *senderName = [self.message objectForKey:@"senderName"];
    NSString *title = [NSString stringWithFormat:@"Sent from %@",senderName];
    self.navigationItem.title = title;

    // Do any additional setup after loading the view.

I hope that helps

Yeah, it all good, managed to fix it. Thanks Mike