title: getting error while trying to create sqlite database 'Could not create table' IOS7
body: <p>Hi in my Application I'm trying to create a local database to store values with primary key auto increment value but its giving error like.</p>
  
  <pre><code>2014-06-19 14:34:28.499 brt[2363:80b] *** Assertion failure in -[listviewpoliticalViewController createTable:withField1:withField2:withField3:withField4:], /Users/madhavadudipalli/Desktop/ ios projects/brt/brt/listviewpoliticalViewController.m:37
  
  2014-06-19 14:34:28.501 brt[2363:80b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create table'
  </code></pre>
  
  <p>I'm getting error like above lines please tell me how to resolve this issue.</p>
  
  <p>My database create code in .h file.</p>
  
  <pre><code>    -(NSString *) filePath;
      -(void)openDB;
  
      -(void) createTable: (NSString *) tableName
          withField1:(NSString *) field1
          withField2:(NSString *) field2
          withField3:(NSString *) field3
          withField4:(NSString *) field4;
  </code></pre>
  
  <p>Database code in .m file.</p>
  
  <pre><code>     -(void) createTable: (NSString *) tableName
           withField1:(NSString *) field1
           withField2:(NSString *) field2
           withField3:(NSString *) field3
          withField4:(NSString *) field4;
     {
       char *err;
       NSString *sql =[NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS '%@' ( Id integer PRIMARY KEY,'%@' TEXT, '%@' TEXT, '%@' TEXT);",tableName,field1,field2,field3];
     if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &amp;err) != SQLITE_OK) {
         sqlite3_close(db);
         NSAssert(0, @"Could not create table");
        }else{
         NSLog(@"Table Created");
        }
  
      }
      -(NSString *) filePath{
         NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
       return [[paths objectAtIndex:0] stringByAppendingPathComponent:@"bp.sqlite"];
     }
     -(void)openDB{
      if (sqlite3_open([[self filePath] UTF8String], &amp;db)!=SQLITE_OK) {
         sqlite3_close(db);
         NSAssert(0, @"Database failed to open");
  
      }else{
        NSLog(@"database opened");
      }
    }
  </code></pre>
  
  <p>I have used the above code to create the database in <code>sqlite</code> please tell me where I'm doing wrong in the above code how to resolve this issue I have been struck here for long time please help me out.</p>
  
  <p>Thanks. </p>