【求助】一个简单的关于TextField的问题/(ㄒoㄒ)/~~

上课需要做一个简单的判断输入是否为特定字符的输入框,我用TextField的getString方法为何获取不到信息/(ㄒoㄒ)/~~

}<pre class="brush:cpp; toolbar: true; auto-links: false;">

void HelloWorld::touchButton(Object* object, TouchEventType type)
{

switch (type)
{
    
case TouchEventType::TOUCH_EVENT_BEGAN:
    string data = text1->getString ();
    log("%s",data);
    
}

}


}

这是我的获取TextField的代码。data和text1在头文件里已经定义了。断点调试到这里我看下data的值显示读取字符串的字符时出错。何解啊/(ㄒoㄒ)/~~

<pre class="brush:cpp; toolbar: true; auto-links: false;">

    text1 = TextField::create();
    text1->setTouchEnabled(true);
    text1->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2));
    text1->setTextColor(Color4B(100, 0, 100, 220));
    text1->setText("abc");
    this->addChild(text1);

    auto button = Button::create();
    button->setTouchEnabled(true);
    button->loadTextures("button.png", "button_pressed.png", "");
    button->setPosition(Point(visibleSize.width + origin.x - 200, visibleSize.height *0.6 + origin.y));
    
    button->addTouchEventListener(this, toucheventselector(HelloWorld::touchButton));
    this->addChild(button);


这是在init函数里创建文本框的代码。
虚心求教啊~求各路大哥帮忙