Приложение вылетает, когда я открываю представление из NavigationController с помощью UIButton - PullRequest
0 голосов
/ 27 октября 2010

Я выдвигаю простой вид на NavigationController.Представление загружается нормально, и когда я использую встроенную кнопку «Назад», оно правильно выталкивается.

Однако, когда я пытаюсь отобразить представление с помощью собственной кнопки UIB в представлении, происходит сбой.

Это действие, выполняемое моим UIButton:

-(IBAction)iAgreePressed {

[[self navigationController] popViewControllerAnimated:YES];}

Я что-то упускаю здесь очевидное?

Это ошибка, возвращающаяся в консоли:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LegalAgreementController iAgreePressed:]: unrecognized selector sent to instance 0x6169190'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x0283ab99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0298a40e objc_exception_throw + 47
    2   CoreFoundation                      0x0283c6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x027ac2b6 ___forwarding___ + 966
    4   CoreFoundation                      0x027abe72 _CF_forwarding_prep_0 + 50
    5   UIKit                               0x002d67f8 -[UIApplication sendAction:to:from:forEvent:] + 119
    6   UIKit                               0x00361de0 -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x00364262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    8   UIKit                               0x00362e0f -[UIControl touchesEnded:withEvent:] + 458
    9   UIKit                               0x002fa3d0 -[UIWindow _sendTouchesForEvent:] + 567
    10  UIKit                               0x002dbcb4 -[UIApplication sendEvent:] + 447
    11  UIKit                               0x002e09bf _UIApplicationHandleEvent + 7672
    12  GraphicsServices                    0x02f57822 PurpleEventCallback + 1550
    13  CoreFoundation                      0x0281bff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    14  CoreFoundation                      0x0277c807 __CFRunLoopDoSource1 + 215
    15  CoreFoundation                      0x02779a93 __CFRunLoopRun + 979
    16  CoreFoundation                      0x02779350 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x02779271 CFRunLoopRunInMode + 97
    18  GraphicsServices                    0x02f5600c GSEventRunModal + 217
    19  GraphicsServices                    0x02f560d1 GSEventRun + 115
    20  UIKit                               0x002e4af2 UIApplicationMain + 1160
    21  WeiglWorksMobileCommander           0x00001fa2 main + 84
    22  WeiglWorksMobileCommander           0x00001f45 start + 53
    23  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

Спасибо, что уделили время!

1 Ответ

1 голос
/ 27 октября 2010

Подпись метода не совпадает. Кнопка отправляет

-[LegalAgreementController iAgreePressed:]

но вы определили

-[LegalAgreementController iAgreePressed] //(note one arg versus no arg)

IBActions должно быть определено как:

- (IBAction) someMethod:(id)sender

Вам не обязательно включать этот аргумент, но вы хотите для согласованности.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...