-
Notifications
You must be signed in to change notification settings - Fork 61
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
iOS Adomb crash -Multiple locks on web thread not allowed #53
Comments
Which versions of Google Mobile Ads SDK, Xcode and iOS are you using? Unfortunately I don't have any Apple hardware, so I'm afraid I can't help much here. I hope somebody from the community can help us to maintain this module for iOS. |
The same thing happens in the iOS simulator. Version info XCode : Version 10.1 (10B61)
-> 0x1215f1e89 <+297>: ud2 2018-11-14 10:11:06.834799+0900 hoonword[8709:112399] Main -> onReward Button click |
I have encountered similar problem, on Android it works fine, but on iOS after terminating Interstitial Ad the application exits. Unfortunately I am not an iOS developer too and I don't own Mac or any iOS device, so debugging iOS apps is pretty hard for me. Version Info: |
Yeah, we need help from any iOS developer from the community to figure out a solution :( |
UIKit view modifications should be made only on the main thread. NSThread's isMainThread can be used to determine if the current thread is the main. If the current thread is not the main, the modifications can be delegated to it via Dispatch |
I was getting this problem too when returning from a RewardAd. I used the code from the examples provided in this repo and the crash seemed to be occurring on the label text update i.e.
I wasn't sure how to do any of that within Godot, but the closest thing I could find that seemed in the right ballpark was the Is there a better way to fix this within Godot? I don't understand how we would modify a Godot app using Apple's libraries (unless there are "hooks" to them within the Godot API?). |
Thank you @gvdb, this is interesting information. Can you guys (@zettyfactory , @vinchi9 , @rolandoislas) try this workaround? If it really works, we can try fix the code. |
I tested it a little more this morning, and it still appears to be happening. Seems to be an intermittent issue. By luck I must've had a few instances where it didn't crash last night. Will investigate more. |
I can't find any way to fix this within the Godot application. Do the changes suggested by @rolandoislas need to be implemented in the code of this repo itself? I've attempted to make changes to
But when I try to recompile the Godot engine source, I get errors I'm not sure how to fix, such as the undeclared identifier Will keep trying and update if I make any progress. edit: By the way @Shin-NiL, I have an iPhone 6 running iOS 12 that I can test this on if needed. |
I think the loading of the ad needs to be done on the main thread. For example, this line. I do not have hardware on hand to test at the moment, but I will in a week. |
If you can give an example of the code that I would need to add to that line to get it to run on the main thread, I'm happy to test that on my iPhone now. |
Something like this should work. #include <Foundation/Foundation.h>
#include <dispatch/dispatch.h>
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[interstitial loadRequest:request];
});
}
else {
[interstitial loadRequest:request];
} |
I've applied the changes suggested by @rolandoislas on this branch https://github.com/Shin-NiL/godot-admob/tree/issue_53 |
Ok so I changed the loading code for banner ads and reward ads like so:
Then I followed the steps for installing the admob module (i.e. recompiling Godot source etc.). It compiled no problems. The game I've built has a banner ad and a reward ad in it, however the web lock crash still occurs when exiting the reward ad. edit: I also tried having the "main thread" stuff on the Rewarded ad only, and had the banner loaded as it did previously, and the crash still occurs. |
@gvdb Well, it's basically what I did. Can you tell me if you don't use banner the app still crash? |
@Shin-NiL Yep, it all works fine when I remove the banner ad. I tested exiting the video early, and allowing it play all the way through to get the reward. Both were fine. |
@gvdb could you try my new commit https://github.com/Shin-NiL/godot-admob/tree/issue_53? I'm trying to putting everything on the main thread (similar to what happens in the Android code). The code is very ugly, but first we need to know if it works. |
Got this when trying to compile:
|
getBannerWidth and height should not be in the main thread, reverted. Could you try again, please? |
Ok, it compiles now, but the crash still occurs. |
It's really sad :( |
Are there any changes? |
@cagdasc nope, seems like there is not so much iOS devs using Godot :( |
This problem isn't just related to reward video. I get exactly the same crash (Multiple locks on web thread not allowed) on Interstitial when used with banner ads even if I switch banner ad off before displaying. |
@kynora, what class did you call resize() on to remove the banner? |
@wombatwingdings, resize() call from GodotAdMob class. In code when banner resize it remove from view and load request again.
|
@wombatwingdings , full GDScript:
|
@kynora for the first time it makes sense. So the conflict seems to be with the banner on screen. Did you try only hideBanner() instead of resize()? |
I not yet try hideBanner(). Because hideBanner is only hidden image of ads but view still remaining. Other solution is implement all ads in ViewController of engine, but it is not following with engine workflow. |
Fix for iOS Adomb crash -Multiple locks on web thread not allowed #53
Could you guys please test the latest commit from our friend @yamshing? It should finally fix this issue. |
Doesn't seem like the issue has been solved. I've recreated the same issue with what @yamshing changed. |
@Dridia1 Could you test with delay bigger than 0 at |
@yamshing I were using the interstitial ad, so I changed the following line instead:
This works perfect, and I'm running iOS 12.4 on an iPhone X |
@Dridia1 thanks for your test. I will change the delay and commit the change |
you should also wrap your bannerEnable method with a dispatch_async(dispatch_get_main_queue(), ^{ so the ui gets updated on the main thread. |
@canvasbushi thank you for your suggestion I will test this |
found the answer here You have to comment this line, I did this in the AdmobIntersertitial.mm and in AdmobRewarded.mm then you have to recompile again for the iOS Now you can close the add without getting the banner, I have it running on Xcode 11 and Godot 3.1.1 Perhaps it would be better to remove that line from the module and tell the devs to manually call a banner after an Interstitial instead of calling it automatically |
Someone can test? I tested on #124 , and its working fine! Ps: I tested on version 3.1.2, the version 3.2.1 i doesnt test yet |
This issue is fixed on 3.1.2, if someone is still facing this issue, please comment here |
On 2.1 I continue to get this error. In fact, I have stripped everything from the module except the bare minimum of code required by Google to implement a rewarded ad and still receive the error. The issue must be in the engine itself. I have also tried with both Google Ads Frameworks versions 7.41 and 7.60. Same result. Edit: |
Godot 3 should now have this issue fixed, as a patch has been merged. The fix has also been picked into the 2.1.7 branch, though at this time it hasn't been officially released. I manually applied the fixes to my own Godot fork. |
Hey @pchasco , yes, on Godot 3 this issue is fixed, i dont know if 2.1.X still happens. 2.1.X version is still in working by Godot contributors? |
I can’t say for sure, but the patch has been cherry picked for 2.1.7, so
it’s a possibility.
…On Fri, Jun 26, 2020 at 7:45 PM Gustavo Maciel ***@***.***> wrote:
Hey @pchasco <https://github.com/pchasco> , yes, on Godot 3 this issue is
fixed, i dont know if 2.1.X still happens.
2.1.X version is still in working by Godot contributors?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUFIABXH2JJXQNKUQPQS63RYU6JPANCNFSM4GDJHGJA>
.
|
OS target (Android/iOS):
iOS
Godot version:
3.0.6
Issue description:
Everything works well in android.
However, iOS has problems.
For example, an error occurs after Reward Video is terminated.
2018-11-13 04:30:20.350877+0900 hoonword[4062:184752] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
2018-11-13 04:30:20.374741+0900 hoonword[4062:185038] void _WebThreadLock(), 0x10c2ef040: Multiple locks on web thread not allowed! Please file a bug. Crashing now...
(lldb)
I am struggling with this problem for a few days, but I am not an iOS developer, so it is difficult. I would be very grateful if you gave me the answer.
The text was updated successfully, but these errors were encountered: