I am developing a box2d game. In the game I use PushWoosh push notification. It works fine (receiving a push notification from a PushWoosh server), but when I insert a push notification my game crashes. Appdelegate implemented as
-In Appdelegate.h:
@interface AppDelegate:NSObject<UIApplicationDelegate,AdColonyDelegate,PushNotificationDelegate,UIAlertViewDelegate>{
UIWindow *window;
RootViewController *viewController;
PushNotificationManager *pushManager;
}
@property (nonatomic, retain) PushNotificationManager *pushManager;
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) RootViewController *viewController;
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
pushManager = [[PushNotificationManager alloc] initWithApplicationCode:@"PushWoosh App_ID" appName:@"App_Name" ];
pushManager.delegate = self;
[pushManager handlePushReceived:launchOptions];
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:kCCDirectorTypeDefault];
CCDirector *director = [CCDirector sharedDirector];
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGB565
depthFormat:0
];
[director setOpenGLView:glView];
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)
{
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");
}
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeRight];
#endif
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];
[viewController setView:glView];
[window addSubview: viewController.view];
[window makeKeyAndVisible];
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
[self removeStartupFlicker];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if(![defaults integerForKey:@"First"]) {
[[CCDirector sharedDirector]runWithScene:[MainMenu scene]];
}
else {
[[CCDirector sharedDirector]runWithScene:[PlayAsGuestScene scene]];
}
return YES;
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
[pushManager handlePushReceived:userInfo];
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{
[pushManager handlePushRegistration:deviceToken];
NSString *token = [pushManager getPushToken];
}
In the console, I get this error: * The application terminated due to the unannounced exception "NSInvalidArgumentException", reason: '- [AppDelegate onPushAccepted:]: unrecognized selector sent to instance 0xf50d290'
Why is this happening?
source
share