iPhone simulator crashes because of GDP error, also has warning:
warning: 'RootViewController' may not respond to '-peformSelector:withObject:afterDelay:'
crash in debugger console:
{[Session started at
2011-04-30 21:57:58 +0800.]
2011-04-30 21:57:59.414 Gravity Man[57133:207] -[RootViewController peformSelector:withObject:afterDelay:]: unrecognized selector sent to instance 0x4e0d740
2011-04-30 21:57:59.417 Gravity Man[57133:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RootViewController peformSelector:withObject:afterDelay:]: unrecognized selector sent to instance 0x4e0d740' *
Call stack at first throw: (
0 CoreFoundation 0x00f0cbe9 exceptionPreprocess + 185
1 libobjc.A.dylib 0x010615c2 objc_exception_throw + 47
2 CoreFoundation 0x00f0e6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00e7e366 __forwarding + 966
4 CoreFoundation 0x00e7df22 _CF_forwarding_prep_0 + 50
5 Gravity Man 0x00002c8d -[RootViewController viewWillAppear:] + 471
6 UIKit 0x00374c9a -[UINavigationController _startTransition:fromViewController:toViewController:] + 858
7 UIKit 0x0036f606 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
8 UIKit 0x00487e01 -[UILayoutContainerView layoutSubviews] + 226
9 QuartzCore 0x00cab451 -[CALayer layoutSublayers] + 181
10 QuartzCore 0x00cab17c CALayerLayoutIfNeeded + 220
11 QuartzCore 0x00ca437c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
12 QuartzCore 0x00ca40d0 _ZN2CA11Transaction6commitEv + 292
13 UIKit 0x002bb19f -[UIApplication _reportAppLaunchFinished] + 39
14 UIKit 0x002bb659 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
15 UIKit 0x002c5db2 -[UIApplication handleEvent:withNewEvent:] + 1533
16 UIKit 0x002be202 -[UIApplication sendEvent:] + 71
17 UIKit 0x002c3732 _UIApplicationHandleEvent + 7576
18 GraphicsServices 0x01842a36 PurpleEventCallback + 1550
19 CoreFoundation 0x00eee064 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 52
20 CoreFoundation 0x00e4e6f7 __CFRunLoopDoSource1 + 215
21 CoreFoundation 0x00e4b983 __CFRunLoopRun + 979
22 CoreFoundation 0x00e4b240 CFRunLoopRunSpecific + 208
23 CoreFoundation 0x00e4b161 CFRunLoopRunInMode + 97
24 UIKit 0x002bafa8 -[UIApplicati开发者_高级运维on _run] + 636 25 UIKit 0x002c742e UIApplicationMain + 1160 26 Gravity Man 0x0000282a main + 84
27 Gravity Man 0x000027cd start + 53
) terminate called after throwing an instance of 'NSException'
}
.h:
{
@interface RootViewController : UIViewController {
IBOutlet UILabel* Label1;
IBOutlet UILabel* Label2;
IBOutlet UILabel* Label3;
IBOutlet UIImageView* Image1;
IBOutlet UIImageView* Image2;
IBOutlet UIImageView* Image3;
IBOutlet UIButton* newGameButton;
IBOutlet UIButton* facebookButton;
IBOutlet UIButton* settingsButton;
CAKeyframeAnimation* popAnimation;
}
-(IBAction)newGame:(id)sender;
@end
}
.m:
@implementation RootViewController
-(IBAction) newGame:(id)sender { GameScreen* pong = [[GameScreen alloc] initWithNibName:@"GameScreen" bundle:nil];
[self.navigationController pushViewController:pong animated:NO];
} -(void)popView:(UIView*)view { [view setHidden:NO]; [[view layer] addAnimation:popAnimation forKey:@"transform.scale"]; } - (void)viewDidLoad {
popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
popAnimation.keyTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.7], [NSNumber numberWithFloat:1.0], nil];
popAnimation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.01], [NSNumber numberWithFloat:1.1], [NSNumber numberWithFloat:1.0], nil];
[popAnimation retain];
[super viewDidLoad];
}
-(void)viewWillAppear:(BOOL)animated {
[popAnimation setDuration:0.9];
[Label1 setHidden:YES]; [Label2 setHidden:YES]; [Label3 setHidden:YES]; [newGameButton setHidden:YES]; [facebookButton setHidden:YES]; [settingsButton setHidden:YES];
[self performSelector:@selector(popView:) withObject:Label1 afterDelay:0.9]; [self performSelector:@selector(popView:) withObject:Label2 afterDelay:0.95]; [self performSelector:@selector(popView:) withObject:Label3 afterDelay:1];
//"WARNING SHOWS UP AMONG THESE LINES"//
[self performSelector:@selector(popView:) withObject:newGameButton afterDelay:0.9];
[self peformSelector:@selector(popView:) withObject:settingsButton afterDelay:0.95];
[self performSelector:@selector(popView:) withObject:facebookButton afterDelay:1];
[super viewWillAppear:animated];
}
@end
}
Thank you and please help!
Change
[self peformSelector:@selector(popView:) withObject:settingsButton afterDelay:0.95];`
^^
into
[self performSelector:@selector(popView:) withObject:settingsButton afterDelay:0.95];`
^^^
IE add r between pe and formSelector
copy that to your .h file:
-(void)popView:(UIView*)view;
that should do the trick.
精彩评论