sto leggendo un libro dove c'è una sorta di guida passo passo di un app.
credo di aver eseguito tutti i passi correttamente, eppure in xcode mi continua a dare un errore..
questo è il codice che è presente nel file di intestazione "InstaTwitViewController.h"
e questo è invece nel file di intestazione "InstaTwitViewController.m"codice:#import <UIKit/UIKit.h> @interface InstaTwitViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate> { NSArray* activities; NSArray* feelings; } @end
mi da l'errore Incomplete implementation of class "InstaTwitViewController"codice:#import "InstaTwitViewController.h" @implementation InstaTwitViewController // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; activities = [[NSArray alloc] initWithObjects:@"sleeping", @"eating", @"working", @"thinking", @"crying", @"begging", @"leaving", @"shopping", @"hello worlding", nil]; feelings = [[NSArray alloc] initWithObjects:@"awesome", @"sad", @"happy", @"ambivalent", @"nauseous", @"psyched", @"confused", @"hopeful", @"anxious", nil]; } - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *) pickerView { return 2; } - (NSInteger)pickerView:(UIPickerView *) pickerViewnumberOfRowsInComponent :(NSInteger)component { if (component == 0) { return [activities count]; } else { return [feelings count]; } } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { switch (component) { case 0: return [activities objectAtIndex:row]; case 1: return [feelings objectAtIndex:row]; } return nil; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [activities release]; [feelings release]; [super dealloc]; } @end
e con simulatore iOs l'app crasha all'avvio...
in pratica, il problema è sorto quando ho tentato di mettere un picker
grazie dell'aiuto![]()

Rispondi quotando