[mojo.ios.cpp] Crash in BeginRender/EndRender

Monkey Forums/Monkey Bug Reports/[mojo.ios.cpp] Crash in BeginRender/EndRender

maverick69(Posted 2016) [#1]
When I'm using AppODeal 3rd Party SDK to show video ads, monkey crashes in the following lines because the MonkeyAppDelegate isn't found:

int gxtkGraphics::BeginRender(){
	MonkeyAppDelegate *appDelegate=(MonkeyAppDelegate*)[[UIApplication sharedApplication] delegate];
	width=appDelegate->view->backingWidth;


	MonkeyAppDelegate *appDelegate=(MonkeyAppDelegate*)[[UIApplication sharedApplication] delegate];
	[appDelegate->view presentRenderbuffer];


I've replaced the code through the following lines which fixed the crash:

int gxtkGraphics::BeginRender(){

    BBMonkeyAppDelegate *appDelegate = BBIosGame::IosGame()->GetUIAppDelegate();
	width=appDelegate->view->backingWidth;


void gxtkGraphics::EndRender(){
	if( !CFG_OPENGL_GLES20_ENABLED ) Flush();
    BBMonkeyAppDelegate *appDelegate=BBIosGame::IosGame()->GetUIAppDelegate();
	[appDelegate->view presentRenderbuffer];
}