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 Photo Browser iPhone App Connecting to an API using OAuth Introducing API and OAuth 2.0

Brenden Konnagan
Brenden Konnagan
16,858 Points

App Crashing when Adding Code to use SimpleAuth

I have added the code per instructions but am getting an exception raised. Crash report is: "There is no class registered to handle Instagram requests".

Help!

10 Answers

Hey @brendenkonnagan, I work on SimpleAuth and would love to help. The error your are getting means that SimpleAuth can't find the class files that are responsible for handling Instagram authentication. After you install SimpleAuth/Instagram with CocoaPods, your Pods project should look something like this: http://cl.ly/Uigq.

Sam Soffes
STAFF
Sam Soffes
Treehouse Guest Teacher

Brenden Konnagan it looks like you don't have all of the files in your project. Are you sure you're using the workspace and not your project? Did you manually add some of SimpleAuth to your project? If so, it looks like you didn't add all of the files.

Brenden Konnagan
Brenden Konnagan
16,858 Points

Sam Soffes & Caleb Davenport Thank you for the help! So somehow my Xcode project become corrupted. Thankfully I had a TimeMachine backup that I was able to revert too. I reinstalled the CocoaPod and everything is working as expected. :-)

Ha! I was just about to post a similar problem. My error instead is this: html <p>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: *** setObjectForKey: object cannot be nil (key: client_id)</p>

It's basically telling me that I have set my @"client_id" key with the value of nil, which is clearly wrong. I've tried using a different client_id, but to no avail.

EDIT: Looks like calling the instance method "makeKeyAndVisible" on self.window before executing the SimpleAuth code throws an exception. I can't wrap my head around why that is, but that's what was giving me the error. Maybe you could see if that's the problem with yours.

Sam Soffes
Sam Soffes
Treehouse Guest Teacher

So this is a different problem and Brendan's. You need to set the configuration before you make the window visible because the view controller tries to login when it appears. If you set the configuration after, then it won't have a client id. SimpleAuth should handle his a bit better though.

So, just set the configuration before you try to use SimpleAuth. I recommend before you make your window.

Brenden Konnagan
Brenden Konnagan
16,858 Points

My issue is only around the "No class registered to handle the Instagram request. I find it funny that I'm required to register a class when Sam Soffes video doesn't involve him registering a class. Thoughts?

Sam Soffes
STAFF
Sam Soffes
Treehouse Guest Teacher

Hmm you shouldn't need to. I'm checking with my friend that wrote SimpleAuth. Which version of SimpleAuth is everyone using?

Brenden Konnagan
Brenden Konnagan
16,858 Points

I am not in front of my system right now but I installed it last night around 11pm EST. Checking the CocoaPod.org site it appears that this is 'SimpleAuth 0.3.2'. Does that help?

Brenden Konnagan
Brenden Konnagan
16,858 Points

Sam Soffes I am using the workspace. I will run the pod installation again. Just curious does pod support verbose or is there anyway to audit the installation to ensure all components are installed properly?

Brenden Konnagan
Brenden Konnagan
16,858 Points

Sam Soffes still no dice... reinstalled the SimpleAuth/Instagram pod... same error

I've got this error

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There is no class registered to handle instragram requests.'

Any help?