ios - this class is not key value coding-compliant for the key findContact -


this question exact duplicate of:

i new iphone , trying connect iphone sqlite. please me short out problem or suggest me basic step connecting example. thankfull act of kindness. error :

2014-05-17 13:06:20.537 sqlite5[1083:11303] * terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ setvalue:forundefinedkey:]: class not key value coding-compliant key findcontact.' * first throw call stack: (0x2090012 0x119de7e 0x2118fb1 0xc4a711 0xbcbec8 0xbcb9b7 0xbf6428 0x3020cc 0x11b1663 0x208b45a 0x300bcf 0x1c5e37 0x1c6418 0x1c6648 0x1c6882 0x115a25 0x115dbf 0x115f55 0x11ef67 0xe2fcc 0xe3fab 0xf5315 0xf624b 0xe7cf8 0x1febdf9 0x1febad0 0x2005bf5 0x2005962 0x2036bb6 0x2035f44 0x2035e1b 0xe37da 0xe565c 0x1b7d 0x1aa5 0x1) libc++abi.dylib: terminate called throwing exception (lldb)

viewcontroller.m file -:

// //  viewcontroller.m //  sqlite5 // //  created techinfiniti on 17/05/14. //  copyright (c) 2014 techinfiniti. rights reserved. //  #import "viewcontroller.h"  @interface viewcontroller ()  @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib.      nsstring *docsdir;     nsarray *dirpaths;      // documents directory     dirpaths = nssearchpathfordirectoriesindomains(                                                    nsdocumentdirectory, nsuserdomainmask, yes);      docsdir = dirpaths[0];      // build path database file     _databasepath = [[nsstring alloc]                      initwithstring: [docsdir stringbyappendingpathcomponent:                                       @"contacts.db"]];      nsfilemanager *filemgr = [nsfilemanager defaultmanager];      if ([filemgr fileexistsatpath: _databasepath ] == no)     {         const char *dbpath = [_databasepath utf8string];          if (sqlite3_open(dbpath, &_contactdb) == sqlite_ok)         {             char *errmsg;             const char *sql_stmt =             "create table if not exists contacts (id integer primary key autoincrement, name text, address text, phone text)";              if (sqlite3_exec(_contactdb, sql_stmt, null, null, &errmsg) != sqlite_ok)             {                 _status.text = @"failed create table";             }             sqlite3_close(_contactdb);         } else {             _status.text = @"failed open/create database";         }     }  }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (ibaction)savedata:(id)sender {       sqlite3_stmt    *statement;     const char *dbpath = [_databasepath utf8string];      if (sqlite3_open(dbpath, &_contactdb) == sqlite_ok)     {          nsstring *insertsql = [nsstring stringwithformat:                                @"insert contacts (name, address, phone) values (\"%@\", \"%@\", \"%@\")",                                _name.text, _address.text, _phone.text];          const char *insert_stmt = [insertsql utf8string];         sqlite3_prepare_v2(_contactdb, insert_stmt,                            -1, &statement, null);         if (sqlite3_step(statement) == sqlite_done)         {             _status.text = @"contact added";             _name.text = @"";             _address.text = @"";             _phone.text = @"";         } else {             _status.text = @"failed add contact";         }         sqlite3_finalize(statement);         sqlite3_close(_contactdb);     }  }   - (ibaction)findcontact:(id)sender {      const char *dbpath = [_databasepath utf8string];     sqlite3_stmt    *statement;      if (sqlite3_open(dbpath, &_contactdb) == sqlite_ok)     {         nsstring *querysql = [nsstring stringwithformat:                               @"select address, phone contacts name=\"%@\"",                               _name.text];          const char *query_stmt = [querysql utf8string];          if (sqlite3_prepare_v2(_contactdb,                                query_stmt, -1, &statement, null) == sqlite_ok)         {             if (sqlite3_step(statement) == sqlite_row)             {                 nsstring *addressfield = [[nsstring alloc]                                           initwithutf8string:                                           (const char *) sqlite3_column_text(                                                                              statement, 0)];                 _address.text = addressfield;                 nsstring *phonefield = [[nsstring alloc]                                         initwithutf8string:(const char *)                                         sqlite3_column_text(statement, 1)];                 _phone.text = phonefield;                 _status.text = @"match found";             } else {                 _status.text = @"match not found";                 _address.text = @"";                 _phone.text = @"";             }             sqlite3_finalize(statement);         }         sqlite3_close(_contactdb);     } }  @end 

check corresponding xib file. in outlets tab there should binding exclamation mark. forgot remove binding when removed findcontact property in .h file.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -