Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFTwitterUtils crashing [Solved] #153

Closed
aldmitriev opened this issue Sep 1, 2015 · 20 comments
Closed

PFTwitterUtils crashing [Solved] #153

aldmitriev opened this issue Sep 1, 2015 · 20 comments

Comments

@aldmitriev
Copy link

Hello
PFTwitterUtils is crashing when I calling [PFTwitterUtils logInWithBlock:] or [[PFTwitterUtils logInInBackground] continueWithBlock:^id(BFTask *task)block].
It's a rare but stable crash.
Conditions: You just need to delete the Twitter app and delete all twitter accounts in iOS settings.
So, problem in real life: User haven't Twitter account and accidentally tap to Login with Twitter button... And app crashed.

So, I imagine that it should be a web-based dialog to login, but it didn't.
Parse version 1.8.2. Social, Accounts frameworks was added. initializeWithConsumerKey added
iOS SDK, Objective-C
Maybe do I something wrong?
Thank you

Crash:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001082a6495 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000107d7d99e objc_exception_throw + 43
    2   CoreFoundation                      0x000000010826fdce -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 382
    3   CoreFoundation                      0x000000010829b23f +[NSDictionary dictionaryWithObjects:forKeys:count:] + 63
    4   MYAPPNAME                         0x0000000105938b86 -[PF_Twitter _showWebViewDialogAsync:requestSecret:] + 202
    5   MYAPPNAME                         0x000000010593a875 __38-[PF_Twitter _performWebViewAuthAsync]_block_invoke_2 + 234
    6   libdispatch.dylib                   0x000000010b82b851 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x000000010b83e72d _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x000000010b82e3fc _dispatch_main_queue_callback_4CF + 354
    9   CoreFoundation                      0x0000000108304289 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    10  CoreFoundation                      0x0000000108251854 __CFRunLoopRun + 1764
    11  CoreFoundation                      0x0000000108250d83 CFRunLoopRunSpecific + 467
    12  GraphicsServices                    0x0000000108b42f04 GSEventRunModal + 161
    13  UIKit                               0x0000000105ea0e33 UIApplicationMain + 1010
    14  MYAPPNAME                         0x000000010593629f main + 111
    15  libdyld.dylib                       0x000000010ba8e5c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@richardjrossiii
Copy link
Contributor

Thanks for the report (especially the stack trace!). I'll look into it.

@richardjrossiii
Copy link
Contributor

So it looks like the initial oauth token you are receiving from twitter is nil. Which indicates that you either have no network connection, or your client key/secret are incorrect.

As ParseTwitterUtils is not yet open-sourced, my immediate solution for you would be to try and verify that you have network before beginning the auto process.

We will add more defensive checks to ParseTwitterUtils starting in future releases.

@aldmitriev
Copy link
Author

@richardjrossiii Thank you for your message. I have internet connection and keys are correct. I saw this problem strongly without users accounts in iOS settings and without the Twitter app.

How I reproduce: 1) I checked that I can login in my app
2) delete the Twitter app and delete all accounts in Twitter iOS Settings
3) Run again → Crash as result.

Anyway, I have a connection and correct keys.

@aldmitriev
Copy link
Author

@richardjrossiii
Hi, Richard!
Please, don't waste team time for that.
I found the solution! I suggest to add to your tutorial a little more information.

Look. If you use Twitter as a Login in web-site, you must add Callback URL.
If you have an Twitter app, you needn't. But when you use web-base dialog in the app, you must ADD Callback URL to work correct.

So, my solution is simple. Just change phrase in Documents:
3. When asked to specify a "Callback URL" for your Twitter app, please insert a valid URL. This value will not be used by your iOS or Android application, but is necessary in order to enable authentication through Twitter.

https://www.parse.com/docs/ios/guide#users-twitter-users

"This value will not be used by your iOS or Android application" not so correct for understanding.
I thought that I needn't add Callback URL

I hope it should be valuable for new parse users.
Thank you guys!

@aldmitriev aldmitriev changed the title PFTwitterUtils crashing PFTwitterUtils crashing [Solved] Sep 3, 2015
@nlutsenko
Copy link
Contributor

@aldmitriev, this is amazing, thanks for diving deep and finding the source of the problem!
We still should add an error check instead of crashing with an exception, since this is such a fragile piece.

You can contribute to the docs since they are opensource and available here.

Let us know if there is anything else we can help you with!
(BTW, ParseTwitterUtils is going to be opensource very soon, so we can change it together as well)

@acegreen
Copy link

acegreen commented Nov 4, 2015

@nlutsenko I still get the crash

@nlutsenko
Copy link
Contributor

@acegreen can you open the issue on the ParseTwitterUtils repo with more details?
Please double check the callback url and Twitter keys, as was noted before - this is the reason for the crash here.

@acegreen
Copy link

acegreen commented Nov 4, 2015

Yes callback url isn't present on web login so this is expected but the crash is not. I thought we were going to safe guard against that?

Will open a ticker on the other side.

@acegreen
Copy link

acegreen commented Nov 4, 2015

@nlutsenko on a side note, did you receive my email? Sent it to your fb account

@grigorye
Copy link

Guys, we're still getting the crash that looks similar to this. From time to time, but it happens. Our callback url and Twitter keys are setup.

The last time is today. It looks like there're some problems at Twitter side because sometimes it says somthing about failed authentication.

Thread : Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x24644f8f __exceptionPreprocess
1  libobjc.A.dylib                0x32cf5c8b objc_exception_throw
2  CoreFoundation                 0x245633df -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
3  CoreFoundation                 0x245631c3 +[NSDictionary dictionaryWithObjects:forKeys:count:]
4  opas                           0x38d439 -[PF_Twitter _showWebViewDialogAsync:requestSecret:]
5  opas                           0x38ecfb __38-[PF_Twitter _performWebViewAuthAsync]_block_invoke_2
6  libdispatch.dylib              0x332862e3 _dispatch_call_block_and_release
7  libdispatch.dylib              0x332862cf _dispatch_client_callout
8  libdispatch.dylib              0x33289d2f _dispatch_main_queue_callback_4CF
9  CoreFoundation                 0x2460a3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
10 CoreFoundation                 0x24608ae9 __CFRunLoopRun
11 CoreFoundation                 0x24554f31 CFRunLoopRunSpecific
12 CoreFoundation                 0x24554d43 CFRunLoopRunInMode
13 GraphicsServices               0x2c02f201 GSEventRunModal
14 UIKit                          0x27d26879 UIApplicationMain
15 opas                           0xb7a53 main (main.m:20)
16 libdyld.dylib                  0x332a7aaf start

@grigorye
Copy link

According to stats, it looks like Twitter was down the very time we observed the crash.

@nlutsenko
Copy link
Contributor

@grigorye A good repro would be very helpful here.

@grigorye
Copy link

@nlutsenko Yep, but if it's related to problems at Twitter side, I'm not sure it's easily doable.

@artur7
Copy link

artur7 commented Nov 26, 2015

I have the same issue. Has anyone solved this issue?

@artur7
Copy link

artur7 commented Nov 26, 2015

@nlutsenko ping

@aldmitriev
Copy link
Author

@artur7 I solved it here #153 (comment)
Be sure you have latest SDK (use cocoapods only. From last week it's required)

@artur7
Copy link

artur7 commented Nov 26, 2015

@aldmitriev can't I simply drag the libs to the project?

@artur7
Copy link

artur7 commented Nov 26, 2015

I already added callback url

@aldmitriev
Copy link
Author

@artur7 And yes and no ) You can't simply by drag
About Cocoapods https://github.com/ParsePlatform/ParseUI-iOS/issues/169#issuecomment-158311957
Example of Podfile #179 (comment)
If you have issue, try this #179 (comment)

@gorkemkosar
Copy link

@richardjrossiii You are awesome thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants