Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Urgent - IOS crash when enableHybridAppEvents is enabled #745

Closed
regevbr opened this issue Feb 11, 2019 · 5 comments
Closed

Urgent - IOS crash when enableHybridAppEvents is enabled #745

regevbr opened this issue Feb 11, 2019 · 5 comments
Labels

Comments

@regevbr
Copy link

regevbr commented Feb 11, 2019

Bug or feature request

[X] I'm reporting a reproducible issue with the code

Describe the Bug of feature request

IOS app crash when enableHybridAppEvents feature is enabled.
applicationDidBecomeActive method in the plugin can be called multiple times during app lifetime, which causes augmentHybridWKWebView to be called multiple times on the Facebook SDK, which in turn causes an uncaught exception.
This scenario is reproducible on a fresh Simulator - after user tries to login with Facebook and is prompted to enable Facebook login by IOS and then the focus returns to the app, this method is being called again and causes the app to crash

Expected Behavior

Should not call the enableHybridAppEvents if it was already called

Plugin version, OS, devices, etc

Plugin 4.2.0, reprodusable on any simulator running ios 12.1 and on iPad mini running 12.1.4

Additional Context

uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to add script message handler with name 'fbmqHandler' when one already exists.'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010605a1bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000104e3c735 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010605a015 +[NSException raise:format:] + 197
	3   WebKit                              0x000000010475b686 -[WKUserContentController addScriptMessageHandler:name:] + 212
	4   Pruvo                               0x00000001012cd53b +[FBSDKAppEvents augmentHybridWKWebView:] + 218
	5   Pruvo                               0x00000001010207d1 -[FacebookConnectPlugin enableHybridAppEvents] + 353
	6   Pruvo                               0x00000001010196c2 -[FacebookConnectPlugin applicationDidBecomeActive:] + 82
	7   CoreFoundation                      0x0000000105f99bac
@peterpeterparker
Copy link
Collaborator

Could you reproduce the problem with version 4.1.0 of the plugin?

@regevbr
Copy link
Author

regevbr commented Feb 11, 2019

@peterpeterparker I will try, for now I manged to fix it locally by keeping a member property to make sure the augment operation is only handled once and I verified it works in the simulator.
I would submit a PR shortly and get back to you on the 4.1.0 version

@peterpeterparker
Copy link
Collaborator

Copy of comment regarding the Facebook answer in the PR (for history):
https://developers.facebook.com/bugs/242837016595902/

@regevbr
Copy link
Author

regevbr commented Feb 11, 2019

Was just about to post it here.
When can we expect a new release?

@peterpeterparker
Copy link
Collaborator

peterpeterparker commented Feb 11, 2019

@regevbr I was posting my last comment when I was releasing...done now, your PR has been merged and just been released in version v4.2.1

thx again 👍

Lindsay-Needs-Sleep pushed a commit to miloproductionsinc/cordova-plugin-facebook-connect that referenced this issue Mar 7, 2020
Lindsay-Needs-Sleep pushed a commit to miloproductionsinc/cordova-plugin-facebook-connect that referenced this issue Mar 7, 2020
Lindsay-Needs-Sleep pushed a commit to miloproductionsinc/cordova-plugin-facebook-connect that referenced this issue Mar 7, 2020
Lindsay-Needs-Sleep pushed a commit to miloproductionsinc/cordova-plugin-facebook-connect that referenced this issue Mar 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants