Ios UIC应用程序发送事件崩溃
我正在开发示例应用程序,其中我正在子类化Ios UIC应用程序发送事件崩溃,ios,uikit,uiapplication,Ios,Uikit,Uiapplication,我正在开发示例应用程序,其中我正在子类化UIApplication并重写sendEvent函数。一切正常,但有时我会在函数中遇到异常,它们是否有可能通过异常来实现[UIApplication sendEvent]。。下面是我的代码 (void)sendEvent:(UIEvent *)event { [super sendEvent:event]; //Some other things just checking for type of event..etc... }
UIApplication
并重写sendEvent
函数。一切正常,但有时我会在函数中遇到异常,它们是否有可能通过异常来实现[UIApplication sendEvent]
。。下面是我的代码
(void)sendEvent:(UIEvent *)event
{
[super sendEvent:event];
//Some other things just checking for type of event..etc...
}
我在调用
[super-sendEvent:event]之后得到了crash-SIGSEGV
我认为您应该在例行程序结束时移动[super sendEvent:event]
如果您正在拦截,那么应该最后而不是第一个调用超级类方法。如果您先调用super方法,它会将事件传递给所有可能最终吃掉它的响应者。也会看到同样的情况,但这种情况很少见。