Note that there are some explanatory texts on larger screens.

plurals
  1. POInserting Image to sqlite iphone
    primarykey
    data
    text
    <p>Hi All I'm New to Xcode I'm trying to insert image from UITableView to database(sqlite3) in ios 5 i tried below code </p> <pre><code>-(void)addItemCUR { if(addStmt == nil) { const char *sql = "insert into Table(C_Name, C_Image) Values(?,?)"; if(sqlite3_prepare_v2(database, sql, -1, &amp;addStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database)); } sqlite3_bind_text(addStmt, 1, [C_Name UTF8String], -1, SQLITE_TRANSIENT); NSData *ImageData = [[NSData alloc] initWithData:UIImagePNGRepresentation(self.C_Image)]; int returnValue = -1; if(self.C_Image != nil) returnValue = sqlite3_bind_blob(addStmt, 3, [ImageData bytes], [ImageData length], NULL); else returnValue = sqlite3_bind_blob(addStmt, 4, nil, -1, NULL); if(SQLITE_DONE != sqlite3_step(addStmt)) NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); else //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid rowid = sqlite3_last_insert_rowid(database); //Reset the add statement. sqlite3_reset(addStmt); } </code></pre> <p>I'm getting Error like </p> <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString CGImage]: unrecognized selector sent to instance 0xb7c0' *** First throw call stack: (0x158f052 0x1720d0a 0x1590ced 0x14f5f00 0x14f5ce2 0xf8b6c 0x5c65 0x3182 0x7030 0x16d71d 0x16d952 0x9f586d 0x1563966 0x1563407 0x14c67c0 0x14c5db4 0x14c5ccb 0x1478879 0x147893e 0xdda9b 0x2ac8 0x2a25) terminate called throwing an exceptionsharedlibrary apply-load-rules all (gdb </code></pre> <p>Please any one help me to get through this thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload