Error running Quiz (Simple iOS Application) video inside


#1

I can not running the Quiz app, can some body help me?

Video explain -->> http://youtu.be/ZSt2qVbPtDE

Thanks.


#2

Hi,
We probably need to see the code for your QuizAppDelegate.m to help figure this one out. Can you paste it into a message here?


#3

Code for my QuizAppDelegate.m:

[code]#import “QuizAppDelegate.h”

@implementation QuizAppDelegate

@synthesize window=_window;

-(id)init

{

self = [super init];
if (self){
    
    
    // crear dos series arrays
    questions = [[NSMutableArray alloc] init];
    answers = [[NSMutableArray alloc] init];
    
    //anadir preguntas y respuestas a esas series
    [questions addObject:@"Cuanto son 7 + 7?"];
    [answers addObject:@"14"];
    
    [questions addObject:@"Cual es la capital de Vermont?"];
    [answers addObject:@"Montpelier"];
    
    [questions addObject:@"De que esta hecho el conac?"];
    [answers addObject:@"De uvas"];
    
    
}

//devolver la direccion del objeto nuevo
return self;

}

  • (IBAction)showQuestion:(id)sender
    {

    //paso a la siguiente pregunta
    currentQuestionIndex++;

    // Me he saltado alguna pregunta?
    if (currentQuestionIndex == [questions count]) {

      //volver a la primera pregunta
      currentQuestionIndex = 0;
    

    }

    //Llevar la cadena al indice en la serie de preguntas
    NSString *question = [questions objectAtIndex:currentQuestionIndex];

    //registrar la cadena en la consola
    NSLog(@“displaying question: %@”, question);

    //MOstrar la cadena en el campo de la pregunta
    [questionField setText];

    //borrar el campo de respuesta
    [answerField setText:@"???"];

}

  • (IBAction)showAnswer:(id)sender
    {

    //cual es la respuesta actual?
    NSString *answer = [answers objectAtIndex:currentQuestionIndex];

    //Mostrarla en el campo de respuesta
    [answerField setText:answer];

}

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // Override point for customization after application launch.
    [self.window makeKeyAndVisible];
    return YES;
    }

  • (void)dealloc
    {
    [_window release];
    [super dealloc];
    }

@end
[/code]


#4

Problem solved, an error linking showAnswer action with button. :blush:

Thanks.