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

iOS Build a Blog Reader iPhone App Adapting Data for Display Downloading and Displaying an Image

Adapting Data for Display - Challenge 2 or 3 - Help...

Ok, I'm not really sure why I get a compilation error, I enter the following code:

Create an instance of NSData named 'data' with the previously created 'url' object.

-> Bummer! Compilation Error! Make sure you are calling 'dataWithContentsOfURL'. <-

images.m

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com/assets/homepage/logo.png"];

NSData *data [NSData dataWithContentsOfURL:url];

4 Answers

Stone Preston
Stone Preston
42,016 Points
NSData *data [NSData dataWithContentsOfURL:url]

you are missing an = it looks like. could be the issue

Doh!

Thanks!

NSData *data = [NSData dataWithContentsOfUrl:url];

This is what I'm putting in and I'm getting a compilation error as well.

Stone Preston
Stone Preston
42,016 Points
NSData *data = [NSData dataWithContentsOfURL:url];

the letters URL on the end of the method name should all be capitalized. you currently have

NSData *data = [NSData dataWithContentsOfUrl:url];

which uses a capital U but lower case r and l, which is why its not working

Something wrong there i think. Keeps giving me the same error.

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com/assets/homepage/logo.png"];
NSData *data = [NSData dataWithContentsOfURL:url];

This is the error i get: Looks like you have not defined 'data'

Adham Gad
Adham Gad
9,899 Points

Onur Tekin same here ! it gives me the same error

Stuart King
Stuart King
2,218 Points

I have this same issue

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com/assets/homepage/logo.png"];
NSData *data = [NSData dataWithContentsOfURL: url];