Simple app not working - need some guidance


#1

Good day,

I seem to have some problems with the .m file in the simple app. I ran some other NSLog commands to see if there was a count at all of the records but it resounded with 0. This is what I have and it is copied identical to the one in the book.

It appears to me that the init method is not getting past the if statement

Any assistance would be great.

Motty

  • (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{
//Call the init method implemented by the Superclass
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
//Create two arrays and make the pointers point to them
questions = [[NSMutableArray alloc] init];
answers = [[NSMutableArray alloc] init];

    //Add questions to the arrays
    [questions addObject:@"What is 7+7"];
    [answers addObject:@"14"];
    
    [questions addObject:@"What is the capital of the UK"];
    [answers addObject:@"London"];
    
    [questions addObject:@"what colour is red wine"];
    [answers addObject:@"Red"];
}


//Return the address of the new object
return self;

}


#2

See this post in iOS Programming 3rd Edition.

viewtopic.php?f=212&t=8007&p=24897#p24897