Nice to see this extension keep getting love! Unfortunately Iâm unable to use 1.2.174 because of this bug.
Is there a way to use the iOS 14 compatible version of the extension with 1.2.172?
Edit: I upgraded to Defold 1.2.174 and tried using DefVideoAds v3.4.8. As soon as unityads.initialize() is called, there is a hard crash on iOS (13.5.1). Reverting back to v3.4.2 solved the problem.
Have there been any changes to the API between v3.4.2 and v3.4.8?
I have tested the newest version on iPhone 5c with iOS 10.3.3 it works fine.
If you provide logs it help me to find the reason for the crash. Unfortunately, I donât have a device with iOS 13.5.1.
Yes, use beta extender server (https://build-stage.defold.com) even if you use 1.2.172 (the extender has one critical fix for v3.4.8)
The ad implementation in the game hasnât changed. Any idea what might cause this? Iâm not certain itâs to do with DefVideoAds, but the âDefUnityCallbackâ appears to suggest it is?
Could you check please if default example project works for you (download project from rep. of DefVideoADS and build).
(Iâm re-checking using the latest 1.2.174)
UPD: Also, try this, pls:
Remove âbuildâ folder from your project folder
Build and test game again
UPD2:
I watched 14 x 4 = 56 videos + opened 2 x 4 = 8 banners, it works for me.
Sooooo, that means I canât reproduce this issue without exact steps, and minimal repo case. Also it would be nice to know more info about devices you tested on (OS, Model).
Could you provide your project with all the extensions you use, please? Iâll take a look today evening.
UPD:
The simplest way is to cut off all the extensions you use and check. Then if you donât have crash, return just a half of cut extensions and so on.
Thanks for your help @AGulev! Iâm going in. Iâll ignore the pure Lua extensions for now, to make the task less daunting. Wish me luck!
Update 1: I was lucky in my first batch. One (or more!) of these is the culprit: Facebook, GameAnalytics, Firebase or Google Play.
Update 2: It seems to have something to do with Firebase; keeping all extensions except Firebase causes no crash. However, an .apk with only Firebase and DefVideoAds also doesnât crash. This stumped me a bit. Any suggestions?
When it does crash, it consistently happens as the DefVideoAds callback is fired, so a few seconds after the unityads.initialize() call.
Update 3: A new iOS+Android build of the full game, with the Firebase extension removed, works and doesnât crash. How can we allow both DefVideoAds and Firebase to coexist?
Iâll take a look today evening and try to figure out.
UPD: If you add firebase into DefVideoADS example project, can you reproduce this crash? Could you try to create minimal repo-case for me based on DefVideoADS example, please? @totebo
Very unlikely, because an entirely empty project with only DefVideoAds and Firebase doesnât crash. I guess this means there is (at least) another extension that causes an issue, but finding which one would be very time consuming.
Since I can consistently replicate the crash, is there a way I could produce a more detailed error that could help narrow it down? I could send a debug .apk if that helps?
I think it depends on what you call before show ADS and in ADS callback. Try to do the same In empty example.
One more option is to share your project with me (in PM of course)
Are you sure itâs a broken Lua stack? According to the crash shared by Totebo it seems like it is this line crashing:
The key_1 and value_1 values are not checked. Are we sure they are ok? Perhaps you could dmLogInfo() print them one by one before they are used and put that on a branch for Totebo to try?
Also, @totebo: How are you invoking any of the DefUnityAds functions? Are they called from within some callback or directly from the Defold lifecycle functions?
local M = {}
local function unity_ads_callback( self, msg_type, message )
pprint( "unity_ads_callback()", self, msg_type, message )
end
function M.initialize()
pprint( "ads.initialize()" )
local test_mode = false
local game_id
local sys_info = sys.get_sys_info()
if sys_info.system_name == "Android" then
game_id = "4350934"
elseif sys_info.system_name == "iPhone OS" then
game_id = "2309234"
end
if unityads then
local unityads_is_supported = unityads.isSupported()
print( "unityads.isSupported()", unityads_is_supported )
if unityads_is_supported then
if unityads.isInitialized() then
print("unityads.setCallback()", unity_ads_callback )
unityads.setCallback(unity_ads_callback)
else
print("unityads.initialize()", game_id, unity_ads_callback, test_mode )
unityads.initialize( game_id, unity_ads_callback, test_mode )
end
else
--print("Unity Ads are not supported on this device")
end
end
end
return M
Called like this:
local ads = require "main.ads"
function init(self)
ads.initialize()
end
Ok, so there really shouldnât be any problem with other extensions when setting up the callback. The DefUnityAds extension callback uses polling and will run together with other extensions which have an update method defined. But I donât really see how they would interfere, especially since youâre restoring the Lua state from the callback. Printing values inside that callback function in the extension may help shed some light on the problem.
The crash always happens after I call unityads.initialize(), so I have never made it far enough to show any ads.
Anything printed in the callback doesnât show, for some reason. The crash seems to override it. Or maybe the printing itself causes the crash? Worth testing.
Update: I read now you meant inside the extension, doh. In any case, it still crashes, with this error message in Defold: