Skip to content
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

ios9 soft keyboard dictation button crash #298

Closed
codeservice opened this issue Dec 28, 2015 · 8 comments
Closed

ios9 soft keyboard dictation button crash #298

codeservice opened this issue Dec 28, 2015 · 8 comments
Labels

Comments

@codeservice
Copy link
Contributor

When I click voice dictation button on soft keyboard app crash with:
on poll -> stage render -> GLEngine`gleRunVertexSubmitARM -> EXC_BAD_ACCESS

@hughsando
Copy link
Member

I wonder if the bug is not in the render code directly, but caused by a memory overwrite from earlier.
Another possibility is threading, but that is usually only on android.

@codeservice
Copy link
Contributor Author

I was able prevent this error by setting stage.framerate = 0 before keyboard open and dictation button clicked. Of corse this solution useless I need update screen from keyboard events. Googled it and many solutions suggestion was to disable OpenGL cache, not sure if it related to this bug.

Sent from my iPad

On Dec 28, 2015, at 22:46, Hugh Sanderson notifications@github.com wrote:

I wonder if the bug is not in the render code directly, but caused by a memory overwrite from earlier.
Another possibility is threading, but that is usually only on android.


Reply to this email directly or view it on GitHub.

@codeservice
Copy link
Contributor Author

More updates.

I can see this bug only if I have 3 or more sprites with graphics. Less then three opengl works fine. I recompile nme in debug mode and have more detailed info for this bug:
OpenGLContext.cpp->void RenderData->glDrawArrays(sgOpenglType[element.mPrimType], 0, element.mCount );->libglInterpose.dylibdraw_arrays(__GLIContextRec*, unsigned int, int, int):->GLEnginegleRunVertexSubmitARM:->EXC_BAD_ACCESS

Code to reproduce bug:

    var sprite1 = new Sprite();
    sprite1.y = 0;
    sprite1.x = 0;
    sprite1.graphics.beginFill(0x0000FF);
    sprite1.graphics.drawRect(0,0,100,100);
    sprite1.graphics.endFill();
    addChild(sprite1);

    var sprite2 = new Sprite();
    sprite2.y = 300;
    sprite2.x = 300;
    sprite2.graphics.beginFill(0x00FF00);
    sprite2.graphics.drawRect(0,0,100,100);
    sprite2.graphics.endFill();
    addChild(sprite2);

    var sprite3 = new Sprite();
    sprite3.y = 10;
    sprite3.x = 500;
    sprite3.graphics.beginFill(0xFF0000);
    sprite3.graphics.drawRect(0,0,10,10);
    sprite3.graphics.endFill();
    addChild(sprite3);

    stage.requestSoftKeyboard();

On soft keyboard voice dictation button. (IOS9.2)

@codeservice
Copy link
Contributor Author

Had time check this problem closely. IOS can lost current EAGL context from time to time. It happens for example when user activate siri or use keyboard dictation button. This breaks nme opengl rendering. Frame looping need constantly check this situation and return context to it original state.

In UIStageView.mm method mainLoop can be updated with follow code modifications. Works for me at list.

  • (void) mainLoop:(id) sender
    {
    if (animating)
    {
    if (stage->nmeView->mOGLContext && [EAGLContext currentContext] != stage->nmeView->mOGLContext)
    [EAGLContext setCurrentContext:stage->nmeView->mOGLContext];

    Event evt(etPoll);
    stage->OnEvent(evt);
    }
    }

@dyarosla
Copy link

Are you sure you didn't make any other changes except for that one? I tried to add those two lines in, but they didn't seem to fix the crashing bug on iOS when hitting the dictation button.

@codeservice
Copy link
Contributor Author

Yes. Works for me. Check if you maybe still using old nme libs in you project.

@dyarosla
Copy link

Thanks codeservice! I just updated everything to latest github build and it works like a charm. I guess now we just need to get the dictation mid-dictate to update an inputfield, but otherwise, there's no crash and now it's possible to submit apps with native keyboards to the app store 👍

@dyarosla
Copy link

dyarosla commented Jun 27, 2016

Moreover, I tested a similar fix in openFL's engine and it seems like openFL has more issues than this one and still crashes on dictation. Therefore NME is now more stable than OpenFL for native keyboards on iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants