2011-04-30 124 views
0

警告: 'RootViewController的' 可不回应 '-peformSelector:withObject:afterDelay:'iPhone模拟器崩溃,也有警告:

崩溃调试器控制台:

{[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   -[UIApplication _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 

} 

谢谢,请帮忙!

回答

2

变化

[self peformSelector:@selector(popView:) withObject:settingsButton afterDelay:0.95];` 
     ^^ 

[self performSelector:@selector(popView:) withObject:settingsButton afterDelay:0.95];` 
     ^^^ 

IE添加[R PE和之间 formSelector

+0

感谢这么多,我想我太粗心了! – user722566 2011-04-30 14:47:05

0

复制到您的.h文件中:

-(void)popView:(UIView*)view; 

应该做的伎俩。

+0

遗憾的是它并没有这样的伎俩 – user722566 2011-04-30 14:27:50