我正在開發一個iphone應用程序,您在登錄服務器並驗證通過後,我的應用程序將您移動到另一個可以使用按鈕發送gps位置的viewcontroller 。出於某種原因,當我在我的下一個視圖 - 控制按下一個按鈕,我得到這個錯誤:iPhone:IBAction導致「無法識別的選擇器發送到實例」錯誤
Administrator[3148:c07] -[UIViewController SendGPS:]: unrecognized selector sent to instance 0x88b58d0
2013-01-08 16:01:21.662 Administrator[3148:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController SendGPS:]: unrecognized selector sent to instance 0x88b58d0'
如果我申請在單一視圖 - 控制我的GPS代碼按鈕事實證明工作正常,但是當我用我的應用程序與兩個視圖控制器,當第一個將你重定向到第二個時(如果你只是登錄到服務器),我得到這個錯誤。我通過檢查服務器響應的條件移動到第二個視圖控制器。這是我用來改變viewcontrollers代碼:
NSString *compare = [NSString stringWithFormat:@"true"];
if ([compare isEqualToString:string]) {
UIViewController* FourthViewController = [[UIViewController alloc] initWithNibName:@"FourthViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:FourthViewController.view]; }
else
NSLog(@"validation not complete");
,這是我的按鈕,在這裏我使用一個NSTimer:
-(IBAction)SendGPS:(id)sender
{
Timer= [NSTimer scheduledTimerWithTimeInterval:30.0 target:self selector:@selector(requestIt) userInfo:nil repeats:YES];
}
有什麼想法?提前致謝!
粘貼requestIt功能 –