2011-06-09 11 views
16

Estoy tratando de compilar y ejecutar un tutorial simple para una aplicación de Objective C utilizando Interface Builder. Estoy usando Xcode 4.0.2 y la simulación en IOS (iPhone) 4,3Objetivo C, subproceso 1 Programa de señal recibida SIGABRT

http://www.switchonthecode.com/tutorials/creating-your-first-iphone-application-with-interface-builder

Cuando construyo el proyecto, se construye bien, pero una vez que la aplicación intenta ejecutar se estrella con:

int main(int argc, char *argv[]) 
{ 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
    int retVal = UIApplicationMain(argc, argv, nil, @"SimpleUIAppDelegate"); 
    [pool release]; 
    return retVal; 
} 

Aparece el error en la línea 4: int retVal = UI ... Subproceso 1: Programe la señal recibida "SIGABRT".

Si los otros archivos de este proyecto necesitan ser publicados para mayor claridad, puedo hacerlo.

Gracias!

Editar:

SimpleUIViewController.h:

#import <UIKit/UIKit.h> 

@interface SimpleUIViewController : UIViewController <UITextFieldDelegate> { 
    UITextField *textInput; 
    UILabel *label; 
    NSString *name; 
} 

@property (nonatomic, retain) IBOutlet UITextField *textInput; 
@property (nonatomic, retain) IBOutlet UILabel *label; 
@property (nonatomic, copy) NSString *name; 

- (IBAction)changeGreeting:(id)sender; 

@end 

SimpleUIViewController.m:

#import "SimpleUIViewController.h" 

@implementation SimpleUIViewController 

@synthesize textInput; 
@synthesize label; 
@synthesize name; 

- (IBAction)changeGreeting:(id)sender { 
    self.name = textInput.text; 

    NSString *nameString = name; 
    if([nameString length] == 0) { 
     nameString = @"Inigo Montoya"; 
    } 
    NSString *greeting = [[NSString alloc] 
          initWithFormat:@"Hello, my name is %@!", nameString]; 
    label.text = greeting; 
    [greeting release]; 
} 

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField { 
    if(theTextField == textInput) { 
     [textInput resignFirstResponder]; 
    } 
    return YES; 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Release anything that's not essential, such as cached data 
} 

- (void)dealloc { 
    [textInput release]; 
    [label release]; 
    [name release]; 
    [super dealloc]; 
} 

@end 

mensaje de error:

This GDB was configured as "x86_64-apple-darwin".Attaching to process 2668. 
2011-06-09 11:20:21.662 InterfaceBuilder[2668:207] Unknown class InterfaceBuilderAppDelegate_iPhone in Interface Builder file. 
2011-06-09 11:20:21.666 InterfaceBuilder[2668:207] *** Terminating app due to uncaught  exception 'NSUnknownKeyException', reason: '[<UIApplication 0x4b1a900>  setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textInput.' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00dc25a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x00f16313 objc_exception_throw + 44 
    2 CoreFoundation      0x00dc24e1 -[NSException raise] + 17 
    3 Foundation       0x00794677 _NSSetUsingKeyValueSetter + 135 
    4 Foundation       0x007945e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285 
    5 UIKit        0x0021030c -[UIRuntimeOutletConnection connect] + 112 
    6 CoreFoundation      0x00d388cf -[NSArray makeObjectsPerformSelector:] + 239 
    7 UIKit        0x0020ed23 -[UINib instantiateWithOwner:options:] + 1041 
    8 UIKit        0x00210ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 
    9 UIKit        0x0001617a -[UIApplication _loadMainNibFile] + 172 
    10 UIKit        0x00016cf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291 
    11 UIKit        0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533 
    12 UIKit        0x00019abf -[UIApplication sendEvent:] + 71 
    13 UIKit        0x0001ef2e _UIApplicationHandleEvent + 7576 
    14 GraphicsServices     0x00ffb992 PurpleEventCallback + 1550 
    15 CoreFoundation      0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    16 CoreFoundation      0x00d03cf7 __CFRunLoopDoSource1 + 215 
    17 CoreFoundation      0x00d00f83 __CFRunLoopRun + 979 
    18 CoreFoundation      0x00d00840 CFRunLoopRunSpecific + 208 
    19 CoreFoundation      0x00d00761 CFRunLoopRunInMode + 97 
    20 UIKit        0x000167d2 -[UIApplication _run] + 623 
    21 UIKit        0x00022c93 UIApplicationMain + 1160 
    22 InterfaceBuilder     0x000027ff main + 127 
    23 InterfaceBuilder     0x00002775 start + 53 
    24 ???         0x00000001 0x0 + 1 
) 
terminate called after throwing an instance of 'NSException' 
sharedlibrary apply-load-rules all 
Current language: auto; currently objective-c 
(gdb) 

Im nuevo a OBJ-c, y tener absolut No tengo idea de lo que estoy mirando con respecto a ese mensaje de error. ¿Alguna ayuda?

+1

Sí, creo que tendrá que proporcionar mucha más información de código y más accidente ... ¿Usted ha conseguido otra cosa que SIGABRT, como una excepción, una pila de llamadas, etc ...? – jv42

+0

¿Es eso suficiente? Es prácticamente todo. –

+0

¡Sí! Eso debería ser suficiente para darte una respuesta, lo estoy analizando ahora mismo. – jv42

Respuesta

21

Tiene un error en su archivo NIB/XIB.

Parece que anteriormente ha conectado un IBOutlet (textInput) y ahora la conexión está rota. Debería verificar dos veces todas las conexiones en Interface Builder.

2

Ahora lo veo! Su informe de bloqueo dice:

Unknown class InterfaceBuilderAppDelegate_iPhone 

Por lo tanto, parece que se establece su aplicación Delegado en el IB de esta clase, pero la clase no está disponible en su proyecto. Mira esto. O ha escrito mal el nombre de la clase o debe agregar la clase relevante a su proyecto.

Es muy probable que su campo de texto esté conectado a este delegado de la aplicación.

¿Ha conectado su campo de texto en Interface Builder al SimpleUIViewController?

Como parece que por el tutorial no está utilizando MainWindow.xib, diría que su proyecto no está ejecutando el delegado adecuado. Intente hacer este cambio en su principal:

int retVal = UIApplicationMain (argc, argv, nil, @ "SimpleUIAppDelegate");

Si mi hipótesis es correcta, eso debería avanzar.

+0

Eso no lo hizo. Todavía recibo el mismo mensaje de error en el mismo lugar. Pero, ¿qué hizo exactamente eso? –

+0

Y estoy usando MainWindow.xib –

+0

Ver mi edición, por favor ... – sergio

3

Es probable que haya configurado incorrectamente el tipo de "Propietario del archivo" en UIViewController en el xib de SimpleUIViewController.Configúrelo en SimpleUIViewController en el panel del inspector de identidades.

0

hilo 1 programa recibió por SIGABRT Singal

algunas veces el valor es NSString va a nill!

¡puede causar esto mientras se inicializa su aplicación!

2

Para solucionarlo, cargue el XIB en Interface Builder, seleccione la pestaña Inspector de archivos y desmarque Usar diseño automático. Alternativamente, puede dirigirse a dispositivos iOS 6.0 + -only y cambiar el objetivo mínimo, si es absolutamente necesario tener autolayout.

NSLayoutConstraint SIGABRT on iPad