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

Open safariViewController from main thread #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tqc
Copy link
Contributor

@tqc tqc commented Aug 28, 2017

Fixes a crash when immediately reopening the safari view.

@hpinsley
Copy link

HI Tom. I think your pull request may be a fix for my problem.

2017-09-11 07:30:12.780 TimeTrackerMobile[17121:1727273] authorize ----> {
    "access_token_url" = "https://github.com/login/oauth/access_token";
    "api_url" = "https://api.github.com";
    "app_name" = timetracker;
    "auth_version" = "2.0";
    "authorize_url" = "https://github.com/login/oauth/authorize";
    "callback_url" = "timetracker://oauth";
    "client_id" = e0...48;
    "client_secret" = d2...b8;
    scopes = email;
} <DCTOAuth2Account: 0x60000033d880; type = github; identifier = B83AA7B7-F783-47EF-B038-533A7458D38F; credential = (null)>
2017-09-11 07:30:59.290 TimeTrackerMobile[17121:1727228] *** Assertion failure in -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/Keyboard/UIKeyboardTaskQueue.m:432
2017-09-11 07:30:59.303 TimeTrackerMobile[17121:1727228] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000109b86b0b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x0000000108a3c141 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000109b8acf2 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x0000000106cbf536 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
	4   UIKit                               0x0000000107d13f6f -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 165
	5   UIKit                               0x0000000107494515 -[UIKeyboardImpl setDelegate:force:] + 1372
	6   UIKit                               0x00000001078aa63d -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 992
	7   UIKit                               0x00000001078b3c4b -[UIPeripheralHost(UIKitInternal) _preserveInputViewsWithId:animated:reset:] + 499
	8   UIKit                               0x000000010738a35d -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1145
	9   UIKit                               0x000000010738bfae -[UIViewController _presentViewController:withAnimationController:completion:] + 4660
	10  UIKit                               0x000000010738ee8a -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
	11  UIKit                               0x000000010738e962 -[UIViewController presentViewController:animated:completion:] + 181
	12  TimeTrackerMobile                   0x00000001061693d9 __34+[OAuthManager setupOAuthHandler:]_block_invoke + 281
	13  DCTAuth                             0x0000000106ba55bc -[DCTAuthPlatform openURL:completion:] + 252
	14  DCTAuth                             0x0000000106bab505 -[DCTAuthURLOpenerOperation start] + 181
	15  Foundation                          0x0000000106c295fc __NSOQSchedule_f + 198
	16  libdispatch.dylib                   0x000000010bfad05c _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x000000010bf8b94f _dispatch_queue_serial_drain + 221
	18  libdispatch.dylib                   0x000000010bf8c669 _dispatch_queue_invoke + 1084
	19  libdispatch.dylib                   0x000000010bf8eec4 _dispatch_root_queue_drain + 634
	20  libdispatch.dylib                   0x000000010bf8ebef _dispatch_worker_thread3 + 123
	21  libsystem_pthread.dylib             0x000000010c3445a2 _pthread_wqthread + 1299
	22  libsystem_pthread.dylib             0x000000010c34407d start_wqthread + 13
)

Is there a related issue for this?

@joncursi
Copy link

joncursi commented Oct 4, 2017

I can confirm that this works for me! I was scratching my head over this one!

@ArtisanalPickle
Copy link

Yea this one is pretty insidious; happens to me in my app about 50% of the time right now. Would love to see this get merged...

blakek added a commit to gsandf/react-native-oauth that referenced this pull request Jan 11, 2018
@blakek
Copy link

blakek commented Jan 11, 2018

Can confirm this corrects a problem we were seeing with an app we have that opens the web view on a refresh.

To hopefully help anyone coming from a search engine, the error we were getting was:

accessing _cachedSystemAnimationFence requires the main thread ...

@johnyoonh
Copy link

Any plan to merge this in soon?

Copy link

@johnyoonh johnyoonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix works and have been confirmed by other users in the thread.

@blakek
Copy link

blakek commented Mar 7, 2018

@johnyoonh Our team forked this to https://github.com/gsandf/react-native-oauth because this repo seems inactive. We pulled this PR in and made a couple other fixes where this wasn't following the OAuth 2.0 spec, including:

  • scopes must be separated by spaces (section 3.3)
  • the client secret must not be sent in the request URI when fetching the access token (section 2.3.1)

We'd love to help get this working with OAuth 2.0 if this becomes active again.

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

Successfully merging this pull request may close these issues.

6 participants