iphone - Why am I getting "Expected getter method not found"? -
iphone - Why am I getting "Expected getter method not found"? -
i working on iphone database app , got "expected getter method not found".i don't why i'm getting message. tried sorts of troubleshooting. it's in line of code:
nsstring *inserstmt = [nsstring stringwithformat:@"insert persons(name,age) values ('%s' '%d')",[self.namefield.text utf8string],[self.agefield.text intvalue]];
here's code:
#import "viewcontroller.h" @interface viewcontroller () { nsmutablearray *arrayofperson; sqlite3 *persondb; nsstring *dbpathstring; } @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; arrayofperson = [[nsmutablearray alloc]init]; [[self mytableview]setdelegate:self]; [[self mytableview]setdatasource:self]; [self createoropendb]; } -(void)createoropendb { nsarray *path = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *docpath = [path objectatindex:0]; dbpathstring = [docpath stringbyappendingpathcomponent:@"persons.db"]; char *error; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; if (![filemanager fileexistsatpath:dbpathstring]) { const char *dbpath = [dbpathstring utf8string]; if (sqlite3_open(dbpath, &persondb)==sqlite_ok) { const char *sql_stmt = "create table if not exists persons (id integer primary key autoincrement, name text, age integer)"; sqlite3_exec(persondb, sql_stmt, null, null, &error); sqlite3_close(persondb); } } } -(nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1; } -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { homecoming [arrayofperson count]; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (!cell) { cell = [[uitableviewcell alloc ]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } person *aperson = [arrayofperson objectatindex:indexpath.row]; cell.textlabel.text = aperson.name; cell.detailtextlabel.text = [nsstring stringwithformat:@"%d", aperson.age]; homecoming cell; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (ibaction)addpersonbutton:(id)sender { if (sqlite3_open([dbpathstring utf8string], &persondb)==sqlite_ok) { nsstring *inserstmt = [nsstring stringwithformat:@"insert persons(name,age) values ('%s' '%d')",[self.namefield.text utf8string],[self.agefield.text intvalue]]; } } - (ibaction)displaypersonbutton:(id)sender { } - (ibaction)deletepersonbutton:(id)sender { } @end
can please help me? give thanks you!
this error telling , have need getter method, i.e. have write getter our properties, if synthesize them, ios internally implements getter method us. thats why have synthesize properties .
@implementation viewcontroller @synthesize namefield,agefield;//property synthesized // remaining code @end
iphone osx xcode4.5
Comments
Post a Comment