2017-05-09 3 views
0

Je suis un débutant de Xcode et j'ai de la difficulté à lire la console d'erreur pour corriger tout ce qui a causé le crash de mon application. Mon code (Swift) compile, mais je reçois l'erreur SIGABRT que j'ai vu tant d'autres sujets. Il semble que la solution soit assez différente pour chaque problème.J'ai besoin d'aide pour lire la console d'erreur de Xcode

2017-05-08 20:57:32.821 ChordGenerator[6335:422217] -[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0 
2017-05-08 20:57:32.825 ChordGenerator[6335:422217] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010b0beb0b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010828b141 objc_exception_throw + 48 
    2 CoreFoundation      0x000000010b12e134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 
    3 CoreFoundation      0x000000010b045840 ___forwarding___ + 1024 
    4 CoreFoundation      0x000000010b0453b8 _CF_forwarding_prep_0 + 120 
    5 UIKit        0x0000000108f87d22 -[UIApplication sendAction:to:from:forEvent:] + 83 
    6 UIKit        0x000000010910c25c -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x000000010910c577 -[UIControl _sendActionsForEvents:withEvent:] + 450 
    8 UIKit        0x000000010910b4b2 -[UIControl touchesEnded:withEvent:] + 618 
    9 UIKit        0x0000000108ff549a -[UIWindow _sendTouchesForEvent:] + 2707 
    10 UIKit        0x0000000108ff6bb0 -[UIWindow sendEvent:] + 4114 
    11 UIKit        0x0000000108fa37b0 -[UIApplication sendEvent:] + 352 
    12 UIKit        0x0000000109786adc __dispatchPreprocessedEventFromEventQueue + 2926 
    13 UIKit        0x000000010977ea3a __handleEventQueue + 1122 
    14 CoreFoundation      0x000000010b064c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    15 CoreFoundation      0x000000010b04a0cf __CFRunLoopDoSources0 + 527 
    16 CoreFoundation      0x000000010b0495ff __CFRunLoopRun + 911 
    17 CoreFoundation      0x000000010b049016 CFRunLoopRunSpecific + 406 
    18 GraphicsServices     0x000000010cf7ba24 GSEventRunModal + 62 
    19 UIKit        0x0000000108f860d4 UIApplicationMain + 159 
    20 ChordGenerator      0x0000000107cb06a7 main + 55 
    21 libdyld.dylib      0x000000010c01065d start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+0

'SIGABRT' signifie seulement qu'il est un' SIG'nal pour le processus de 'AB'o'RT'. Regardez les deux premières lignes de l'erreur, peut-être que cela donnera quelques indications à la source de l'erreur? – Jerrybibo

+0

Voici le problème 'reason: '- [ChordGenerator.ViewController newChordButton:]:'. Soit la méthode 'newChordButton' n'existe pas, soit la classe n'est pas conforme à cette méthode. – nayem

+0

Fixez l'action de votre bouton afin qu'il pointe vers une méthode valide dans votre contrôleur de vue. – rmaddy

Répondre

1

2017-05-08 20:57:32.821 ChordGenerator[6335:422217] -[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0

C'est la ligne que vous devez vous concentrer sur. D'après cela, votre projet "ChordGenerator" qui a un fichier "ViewController" a une fonction à laquelle vous passez un sélecteur "newChordButton". Actuellement, le système est incapable de trouver cette fonction. Dans l'ensemble, passez une fonction nom qui existe dans la portée de la cible, c'est-à-dire si target = self, alors la fonction newChordButton doit être présente dans la classe ViewController.swift actuelle.

Si vous testez, il suffit de faire une fonction vide:

func newChordButton(){ print("Entered newChordButton function") }