nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

Crash in oauthClientDidLoseAccessToken: #117

Closed mdamjanic7 closed 10 years ago

mdamjanic7 commented 10 years ago

I've been looking at my crash logs, and I found this crash occurring rather often:

screen shot 2014-06-19 at 7 03 37 pm

I'm using version 1.2.6. What I don't understand is the fact that line 207 in NSOAuth2Client.m is actually [delegate oauthClientDidRefreshAccessToken:self];, but that method isn't getting invoked.

toto commented 10 years ago

The lines in crash reports can sometimes be a little of for several reasons. The stack trace itself is a better hint than the line numbers.

From looking at the code it's pretty clear, that -[NXAccountStore accountTypeOfPendingOAuthClient:] returns nil, which leads to the exception in you strack trace. This probably means the NXOAuth2Client passed to the method is not around anymore. As the comment in the oauthClientDidLoseAccessToken: method points out "This delegate method should never be called because the account store" so we should just add a nil-check to get rid of this error. This should not hurt the functionality at all. I will add the fix to develop and it will be in the next release.

toto commented 10 years ago

Fix is in 0fabd9f0c969e461d8accd578de31ace69453b6e. If you do not want to wait for the next release just point cocoa pods to 0fabd9f0c969e461d8accd578de31ace69453b6e.