Projects > cpp > Issues > Bug #3066

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

EAGLView is not removed from NSNotificationCenter

Bug #3066 [Closed]
lht 2013-10-25 00:04 . Updated about 2 years ago

The bug appears to be in Apple’s sample code EAGLView. If the view is released then keyboard events crash the process. Fix is simple:
cocos2dx/platform/ios/EAGLView.mm

  • (void)didMoveToWindow;
    {
    if (self.window) {
    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:`selector(onUIKeyboardNotification:)
    name:UIKeyboardWillShowNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:`selector(onUIKeyboardNotification:)
    

    name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:`selector(onUIKeyboardNotification:)
    name:UIKeyboardWillHideNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:`selector(onUIKeyboardNotification:)
    

    name:UIKeyboardDidHideNotification object:nil];
    } else {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    }
    }

walzer@cocos2d-x.org 2014-10-08 02:50

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8239

Atom PDF

Status:Closed
Start date:2013-10-25
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:ios
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.