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

Andrew Brotherton
Andrew Brotherton
7,515 Points

I'm having problems with the quiz Viewing Images from Parse.com

``Quiz- Viewing Images

Fill in the blanks in the following code that sets a UIImageView with an image from Parse:

PFFile *imageFile = [self.photo objectForKey:@“file”]; NSURL *fileUrl = [[NSURL alloc] initWithString:__________.ur]l; NSData *imageData = [NSData dataWithContentsOfURL: ______]; self.imageView.image = [UIImage _________:imageData];

I thought the blanks should be in the first 1. file.url 2nd- fileUrl 3rd- fileWithData? 

This one as well Fill in the blanks to 1) set the 'comments' property to the array returned in this block, and 2) reload the table view: 
 [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (error) { // Skip! } else { self.comments = ; [self.tableView ]; NSLog(@"Retrieved %d messages", [self.messages count]); } }]; I thought it should be in the 1st- blank comments and in the second blank reloadData

4 Answers

ok got it it was

  1. imageFile
  2. fileUrl
  3. imageWithData

Hello Andrew,

you're close, instead of file.url it already has the .url part so simply add that, second part is ok, and for the third part fileWithData isn't what you're looking for, you're trying to set the image so using fileWithData when you should be using imageWithData.

Hope this helps, Kai

Andrew Brotherton
Andrew Brotherton
7,515 Points

I entered, file for the first, second file I entered fileUrl, 3rd I did imageWithData and it didn't work?

ok ill write the test and tell you what i get

Andrew Brotherton
Andrew Brotherton
7,515 Points

That did do it, I tried to leave best answer but I couldn't figure it out.