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 Build a Photo Browser iPhone App Gestures Creating a Detail View Controller

Lei zheng
Lei zheng
7,990 Points

I download the code. run on my xcode. it crash.

2015-01-04 22:56:27.749 Photo Bombers[3010:269214] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil' *** First throw call stack: (0x27cd5c1f 0x35480c8b 0x27cd5b65 0x289839fb 0xb4fa1 0x2775e82f 0x289cf2b1 0x2893a34d 0x2892cb07 0x289d1c1b 0x2d0e29 0x2cb2c9 0x2d2567 0x2d3891 0x35b41e31 0x35b41b84) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)


there are sometime, this work. I check the "data" it refered. I think it is about the tag "photobomb" . for some reason, instagram return nil for my tag. I guess this is the reason.

6 Answers

Have you already addressed the warning on line 19 of THAppDelegate.m? If not, it appears you'll need to register as a developer on Instagram and replace the Client ID on line 22 of that same file, once you're registered. This may explain why you're not getting any data back. Beyond that, I'm not sure what would be holding you back.

Lei zheng
Lei zheng
7,990 Points

yes, I have registered on instagram. and removed the warning. It will run on my iphone. but not in simulator. when it is in iphone. It will run with default tag photobomb. if I change photobomb to something else. it will crash.

Mason

Interesting. I'm not sure what would be causing the problem.

If I think of anything in the near future, I'll post back ASAP. Good luck!

Kyle

Dan Paschevici
Dan Paschevici
4,013 Points

The problem is that *urlString is wrong, it can't find anything. Check if syntax of this line is correct

NSString *urlString = [[NSString alloc] initWithFormat:@"https://api.instagram.com/v1/tags/photobomb/media/recent?access_token=%@", self.accessToken]; and when you replace the word "photobomb" make sure that you don't delete anything else.

Lei zheng
Lei zheng
7,990 Points

thanks Dan, I am trying to update the photos every time i fetch from instagram. It seems like limited to 20 photos. In earlier version, I can direct change it. But in the latter version. I can not find where to update how many photos it fetch back from instagram. can you help?

mason

Dan Paschevici
Dan Paschevici
4,013 Points

Yes by default the limit is 20, but you can add at the end of url count=a_number

NSString *urlString = [[NSString alloc] initWithFormat:@"https://api.instagram.com/v1/tags/photobomb/media/recent?access_token=%@&count=100", self.accessToken];

In my case I put 100, and if there is not 100, it will show you how many are.......

Lei zheng
Lei zheng
7,990 Points

I have update the code according to yours. the photo returned increase from 20 to 33. but not as many as 100. is there another limit imposed by instagram?

mason