ios - error in sqlite3 table creation 'NSInternalInconsistencyException' -


I am having trouble creating a table with sqlite3, I have created a database in code but it returns an error: ' NSInternalInconsistencyException ', reason:' Could not create table '

I tried to review the code to search for bugs but I did not find any code here.

  - (NSString *) file path {NSArray * paths = NSSearchPathForDirectoriesInDomains (NSD Documentation Directory, NSUIR IRMMask, Yes); Return [[Path ObjectOutIndex: 0] stringBuffing string: @ "dbfile sql"]; } - (zero) OpenDB {if (sqlite3_open ([[auto filepath] UTF8String], & amp; DB!) = SQLITE_OK {sqlite3_close (db); NSAssert (0, "Failed to open database"); } And {nslog (@ "database opened!"); }} - (Zero) createTable: (NSString *) with TableNamefield 1: (NSString *) field 1 withField2: (NSString *) field 2 withField3: (NSString *) field3 withField4: (NSString *) field4 {char * err; NSString * sql = [NSString stringWithFormat: @ "If the table is not present then create '% T' ('% @' text primary key, '% @' INTEGER, '% @' INTEGER, '% @' text); " Table "name, field1, field2, field3, field4]; if (sqlite3_exec (db, [sql UTF8String], zero, zero, and error) = SQLITE_OK {sqlite3_close (db); NSAssert (0, @" Table Could not create ");} Else {NSLog (@" created table ");}}  

and I import sqlite3.h , but every time When I run the simulator, it crashes and gives me that error.

Please copy the help file in iOS to your encoded copy and the link below for the code database Check:

and trying to create a table


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -