-
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 Crash #114
Comments
Having this exact issue with my Testflight beta testers :-( |
It seems to have something to do with the latest iOS update 13.3, all testers with this version have the issue. |
I tried running it through xcode directly without testflight and got the following debug output before crashing:
I updated xcode to the latest version |
It also doesn't occur every time, there is a chance to start the app once when I execute it like 10 times in a row. It seems there is a more frequent sucess rate on older devices, so it may be a timing related issue? |
Right, mine seems to work around half the time, and I get exactly that |
I tried updating to the latest admob framework and it seems that the app is starting fine now. I still have some crashes, but I think they are engine related (they fit to godotengine/godot#34221 and godotengine/godot#33154 which is not part of 3.1 if I see it correctly) |
Needs more testing though |
Yeah, using the latest admob frameworks I get a good start rate. Those fixes are on a stable release soon. I tried the beta 3.2b3 version but I think they took away support for arm7 on that version, which prevents my device from being used :-( |
It's still crashing in some devices on start though, e.g. an iPhone 8 |
Same crashlog as in the original post. |
@Shin-NiL Does the "help wanted" flag mean that you don't know where the issue is or that you don't have the time to fix it yourself? Me and my team are near to the planned release and this issue is preventing progress right now. It didn't occur prior iOS 13.3. I sadly have no experience with the development of this module or godot modules in general yet, but if there is something I can do to help, let me know. Thank you for everything you've done, without all this developing mobile games with godot wouldn't be possible! |
This means I don't have the Apple hardware (iphone, mac) and knowledge to fix this. We need help from an iOS developer to fix not only this, but all issues related to this platform. When I added support for iOS, I borrowed a Mac and did everything without knowing exactly how to program to that. It worked for the project I was releasing and since then I can't do anything about the new issues. I'm really sorry ;( |
@Shin-NiL nothing to be sorry for. Do you know anyone who could help? Or would you bother if I link this issue in the official godot community and ask for help? Or do you have some other places where we could ask? I'm currently out of solutions and I really need ads working for the project, as this is our only income from our otherwise free app. :( |
@Tobi-La Feel free to ask for help anywhere, I don't know anybody who can help us. I already have asked for help at the godot repository for another issue, but I haven't found anyone. |
I invested a few hours and compiled the engine and the export templates myself. I used the precompiled custom templates with integrated admob for godot 3.1 from https://github.com/GhostWalker562/godot-admob-iOS-precompiled , which seems was a big mistake. It seems to run fine now. I'll close the issue when I have a few more testers confirm this. Thanks for your help and your work :) |
Nice! I hope everything goes fine from here ;) |
At the end I was able to compile it using the last commit for the stable release 3.1.1 (66baa3b633fe904ea0d90a9688d602d9f3a0b3bd) and following the instructions. The admob error at the begining is now gone. |
@jeudy-ua would you be able to share the compiled templates? |
Thanks man. i'll be looking forward for it. I'm new with the iOS exports with the AdMob, and i'm having some issues trying to figure it out. Your help will be highly appreciate it. |
@CompassDevs here is a repo with the compiled template I used and that work. This still doesn't have the fix for the separate issue of the app crash on exit. But will soon. |
Hey, Thanks. I'll give it a try already. Meantime waiting for the crash fixed one. |
@jeudy-ua Bro, i did try, but seems not to be working, i admit i'm terrible with the xcode part, i'm afraid i'm doing something wrong, in the certificates or adding the google framework, i'm not sure. Do you know when the final "crash free" template will be completed? and most of all, do you have a good step-by-step i can follow? |
@CompassDevs yeah the XCode part can be tricky. Here is my published game on iOS where you can see the ads working (intersitial and rewarded): https://apps.apple.com/us/app/moving-blocks-identicons/id1493046555?ls=1 The precompiled version I put crashes when the app is closed but it goes unnoticed for the user so should not be a roadblock (otherwise the app store would not have approved my game this week). What error are you seeing? is it in the build process on XCode? How far are you getting in the process? |
@jeudy-ua Hello, i think i'm missing or doing wrong some step in putting the "stuff" together, meaning the frameworks, and some other necessary. Xcode either fails on doing the build or gives error. |
@CompassDevs it seems there is a fix for the crash on exit issue (here) so I will try it and create a new precompiled templates with it. After that I will make the step to step tutorial you need for XCode. |
@jeudy-ua Thanks man, you are saving me from a lot of stress!! I'll be waiting patiently |
@jeudy-ua Hello there, I gave it one more try, and still didn't work..... I wonder what do i do wrong.... |
@CompassDevs I uploaded a video showing the steps I followed to build the game. In the descriptions there are more details. Also, I'm updating the .a file I precompiled to include the fix for the crash on exit (its still uploading so it will be at least a few mins after I posted this reply). Hope it helps. |
@jeudy-ua You have been super patient with me heheh. Your video was very clear, after some further issues, i have managed to complete the package, now waiting for review on app store. For the meantime, THANKS man!! |
@jeudy-ua Hey bro, thanks again first of all. Now since my last feedback to you, i have been waiting for a while, but indeed as mentioned already, the ads are not appearing on the iOS devices (for the sake of clarity everything works fine on Android), do you have any idea where the issue could be? |
Hi @CompassDevs, when did you create your admob account and your ad unit? sometimes it takes a few days to show up. Although if they show up on Android then its weird. Have you tried test ads by sending the "isReal"parameter to false? |
@jeudy-ua it was long time ago for Android, and over 3 weeks ago for iOS, i don't think the issue is about waiting anymore, since i also went through it with the Android version at the beginning, and after some time ads start showing. |
Have you tried to use the android ad unit id on the iOS compile? that way you can rule out if the issue is in the compilation process or on the admob side. |
@jeudy-ua no, i didn't. i can give it a try.... although makes no much sense.... |
@jeudy-ua hello there, i have tried, both the suggestions, the test ads (isReal=false) and using android ad unit id. In both cases nothing appears. Can it be the version of the Google sdk? Maybe the one pre-compiled (*.a file which you made) is different version then the one i use in xcode project (as you show in the video)... can this create this issue? When i was trying with android i was checking with the adb, and connecting the phone i could see the request and the fill, do you know if there is a way in iOS? |
Standard C, C ++, etc. states that we have a clear mistake. "Undefined behavior." Since this variable is not global, we can have more than one instance of this class. instance var is not static and not null. See on arkit_module or camera_module or platform/iphone/in_app_store.* sources godotAdmob.h class GodotAdmob : public Reference {
#if VERSION_MAJOR == 3
GDCLASS(GodotAdmob, Reference);
#else
OBJ_TYPE(GodotAdmob, Reference);
#endif
bool initialized;
GodotAdmob *instance; // <<< is not static and is not null!!!
//static GodotAdmob *instance = NULL; //we can write like that!
//The standard с++11 guarantees that this variable will be initialized like this!
//But the standard objective-c++ does not guarantee! The standard objective-c++ does not guarantee anything! > _ <
...
};
#include "godotAdmob.h"
#import "app_delegate.h"
#if VERSION_MAJOR == 3
#define CLASS_DB ClassDB
#else
#define CLASS_DB ObjectTypeDB
#endif
GodotAdmob::GodotAdmob() {
ERR_FAIL_COND(instance != NULL); // <<< ERR ON CONSOLE! instnace is not init!!!
instance = this;
initialized = false; //<< unknow?
/*
since the constructor was not called. Initialization variable - not defined. It may be false or true.
*/
}
GodotAdmob::~GodotAdmob() {
instance = NULL;
//we do not free memory! which was isolated using malloc!!!!
}
...
void GodotAdmob::init(bool isReal, int instanceId) {
if (initialized) {
NSLog(@"GodotAdmob Module already initialized"); //<<The log says that the constructor is initialized, although it is not!
return;
}
initialized = true;
banner = [AdmobBanner alloc];
[banner initialize :isReal :instanceId];
interstitial = [AdmobInterstitial alloc]; //<<allocation does not occur!
[interstitial initialize:isReal :instanceId];
rewarded = [AdmobRewarded alloc];
[rewarded initialize:isReal :instanceId];
}
...
////Godot uses his own link count and locator. memnew () function
////It seems to me that in version 3.2 the functions memnew() were passed
void GodotAdmob::loadRewardedVideo(const String &rewardedId) {
//init
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
NSString *idStr = [NSString stringWithCString:rewardedId.utf8().get_data() encoding: NSUTF8StringEncoding];
[rewarded loadRewardedVideo: idStr]; //Turning to a random memory area!
//Since our memory is allocated using a special function. We can spoil the memory of other objects or go beyond it!
}
ERR_FAIL_COND : Current function ends!!! #define ERR_FAIL_COND(m_cond) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true."); \
return; \
} else \
((void)0) MY FIXgodotAdmob.h #ifndef GODOT_ADMOB_H
#define GODOT_ADMOB_H
#include <version_generated.gen.h>
#include "reference.h"
#ifdef __OBJC__
@class AdmobBanner;
typedef AdmobBanner *bannerPtr;
@class AdmobInterstitial;
typedef AdmobInterstitial *interstitialPtr;
@class AdmobRewarded;
typedef AdmobRewarded *rewardedPtr;
#else
typedef void *bannerPtr;
typedef void *interstitialPtr;
typedef void *rewardedPtr;
#endif
class GodotAdmob : public Reference {
#if VERSION_MAJOR == 3
GDCLASS(GodotAdmob, Reference);
#else
OBJ_TYPE(GodotAdmob, Reference);
#endif
bool initialized;
static GodotAdmob *instance; //<<<< STATIC
bannerPtr banner;
interstitialPtr interstitial;
rewardedPtr rewarded;
protected:
static void _bind_methods();
public:
void init(bool isReal, int instanceId);
void loadBanner(const String &bannerId, bool isOnTop);
void showBanner();
void hideBanner();
void resize();
int getBannerWidth();
int getBannerHeight();
void loadInterstitial(const String &interstitialId);
void showInterstitial();
void loadRewardedVideo(const String &rewardedId);
void showRewardedVideo();
GodotAdmob();
~GodotAdmob();
};
#endif
#include "godotAdmob.h"
#import "app_delegate.h"
#if VERSION_MAJOR == 3
#define CLASS_DB ClassDB
#else
#define CLASS_DB ObjectTypeDB
#endif
GodotAdmob *GodotAdmob::instance = NULL; //<< INIT NULL VAR ON COMPILE TIME!
GodotAdmob::GodotAdmob() {
initialized = false;
banner = NULL;
interstitial = NULL;
rewarded = NULL;
//
ERR_FAIL_COND(instance != NULL); //<< SUCCESS!!! FIRST
instance = this;
}
GodotAdmob::~GodotAdmob() {
if (initialized) {
[banner release]; //free banner
[interstitial release]; //free
[rewarded release]; //free
}
if (instance == this) {
instance = NULL;
}
}
void GodotAdmob::init(bool isReal, int instanceId) {
if (instance != this) {
NSLog(@"GodotAdmob Module dublicate singleton");
return;
}
if (initialized) {
NSLog(@"GodotAdmob Module already initialized");
return;
}
initialized = true;
banner = [[AdmobBanner alloc] init];
[banner initialize :isReal :instanceId];
interstitial = [[AdmobInterstitial alloc] init];
[interstitial initialize:isReal :instanceId];
rewarded = [[AdmobRewarded alloc] init];
[rewarded initialize:isReal :instanceId];
}
void GodotAdmob::loadBanner(const String &bannerId, bool isOnTop) {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
NSString *idStr = [NSString stringWithCString:bannerId.utf8().get_data() encoding: NSUTF8StringEncoding];
[banner loadBanner:idStr :isOnTop];
}
void GodotAdmob::showBanner() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
[banner showBanner];
}
void GodotAdmob::hideBanner() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
[banner hideBanner];
}
void GodotAdmob::resize() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
[banner resize];
}
int GodotAdmob::getBannerWidth() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return 0;
}
return (uintptr_t)[banner getBannerWidth];
}
int GodotAdmob::getBannerHeight() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return 0;
}
return (uintptr_t)[banner getBannerHeight];
}
void GodotAdmob::loadInterstitial(const String &interstitialId) {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
NSString *idStr = [NSString stringWithCString:interstitialId.utf8().get_data() encoding: NSUTF8StringEncoding];
[interstitial loadInterstitial:idStr];
}
void GodotAdmob::showInterstitial() {
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
[interstitial showInterstitial];
}
void GodotAdmob::loadRewardedVideo(const String &rewardedId) {
//init
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
NSString *idStr = [NSString stringWithCString:rewardedId.utf8().get_data() encoding: NSUTF8StringEncoding];
[rewarded loadRewardedVideo: idStr];
}
void GodotAdmob::showRewardedVideo() {
//show
if (!initialized) {
NSLog(@"GodotAdmob Module not initialized");
return;
}
[rewarded showRewardedVideo];
}
void GodotAdmob::_bind_methods() {
CLASS_DB::bind_method("init",&GodotAdmob::init);
CLASS_DB::bind_method("loadBanner",&GodotAdmob::loadBanner);
CLASS_DB::bind_method("showBanner",&GodotAdmob::showBanner);
CLASS_DB::bind_method("hideBanner",&GodotAdmob::hideBanner);
CLASS_DB::bind_method("loadInterstitial",&GodotAdmob::loadInterstitial);
CLASS_DB::bind_method("showInterstitial",&GodotAdmob::showInterstitial);
CLASS_DB::bind_method("loadRewardedVideo",&GodotAdmob::loadRewardedVideo);
CLASS_DB::bind_method("showRewardedVideo",&GodotAdmob::showRewardedVideo);
CLASS_DB::bind_method("resize",&GodotAdmob::resize);
CLASS_DB::bind_method("getBannerWidth",&GodotAdmob::getBannerWidth);
CLASS_DB::bind_method("getBannerHeight",&GodotAdmob::getBannerHeight);
} PS: The whole code is an attempt to shoot both legs!) I suspect that the memory worked like this: T* memnew(T) {
auto ptr = memory.realloc(sizeof(T));
memset(ptr, 0, sizeof(T)); //fill memory on zero
return new(ptr) T()r;
}
and then changed due to overhead. T* memnew(T) {
auto ptr = memory.realloc(sizeof(T));
//memset(ptr, 0, sizeof(T)); //memory random byte
return new(ptr) T()r;
}
In general, all Objective-C objects need to implement a constructor (init) interstitial = [[AdmobInterstitial alloc] init];
[interstitial initialize:isReal :instanceId];
...
[interstitial release]; OR interstitial = [[AdmobInterstitial alloc] initWith:isReal :instanceId];
...
[interstitial release];
|
BUG still persists in 3.1.2, but when the debug is stopped, i can open the app normally and doesnt froze anymore, but the error is still there on debug |
Is the error only in the log or crashes? |
The error are in the log, and the app frozen |
OS target (Android/iOS):
iOS
Godot version:
3.1.1 stable
Issue description:
One of my testers has a problem of my app crashing on her iPhone. The crashlog shows the following, which seems it has to do with admob:
The text was updated successfully, but these errors were encountered: