开发者

iphone SIGABRT error with registerForSystemEvents unrecognized selector

Hi I keep try to debug my iPhone app in the iPhone simulator firmware 4.2, but none of the apps open up开发者_JS百科 and I receive this error called "SIGABRT" and the gdb says:

+[MyAppDelegate registerForSystemEvents]: unrecognized selector sent to class...

I never called this function ever... all I did was "New Project" and then "Build and Run"

any suggestions as to how to fix this error?

Thanks, Thommaye


You are calling a method called registerForSystemEvents: on your delegate class, and you don't have a class method in your delegate with that name. Showing the code will also help.


I struggled with this error for a while and couldn't figure it out till just now, so I wanted to throw in what worked for me, just in case someone else stumbles upon this.

In my scenario, I have a PadController.h and a PhoneController.h that both inherit from AppController.h and I kept getting the error that AppController couldn't registerForSystemEvents:

It was failing on a static call, so that it was essentially trying to do [AppController registerForSystemEvents:]

My AppController looked like this:

@interface AppController : NSObject <UIApplicationDelegate, UITabBarControllerDelegate>

First: Make sure your App Delegate inherits from NSObject and conforms to the UIApplicationDelegate protocol.

Second: I had in my plist a line that said Principle Class which was pointing to AppController. Getting rid of this is actually what worked for me specifically. I think it was trying to launch AppController twice (once from Interface Builder and once from this).

Third: Make sure your main.h looks something like this:

@autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, nil);

        return retVal;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜