I am using UIImagePickerControllerDelegate in iOS for image pickup from gallery or form camera it is working fine in real device in iphone but can i use this thing in simulator so that i can see image store in sqlite DB file. This is my code for storing image in sqlite :
NSString *docsDir;
NSArray *dirPaths;
NSString *dbPath;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = dirPaths[0];
dbPath = [[NSString alloc]initWithString:[docsDir stringByAppendingPathComponent:@"clientId.db"]];
sqlite3_stmt *compiledStmt;
sqlite3 *db;
if(sqlite3_open([dbPath UTF8String], &db)==SQLITE_OK){
NSString *insertSQL=@"insert into MESSAGE(MESSAGE,SEENTO) VALUES(?,'visitor')";
if(sqlite3_prepare_v2(db,[insertSQL cStringUsingEncoding:NSUTF8StringEncoding], -1, &compiledStmt, NULL) == SQLITE_OK){
// UIImage *image = [UIImage imageNamed:@"prem.png"];
UIImage *image = chosenImage;
NSData *imageData=UIImagePNGRepresentation(image);
sqlite3_bind_blob(compiledStmt, 1, [imageData bytes], [imageData length], SQLITE_TRANSIENT);
if(sqlite3_step(compiledStmt) != SQLITE_DONE ) {
NSLog( @"Error: %s", sqlite3_errmsg(db) );
} else {
NSLog( @"Insert into row id = %lld", (sqlite3_last_insert_rowid(db)));
}
sqlite3_finalize(compiledStmt);
}
}
sqlite3_close(db);
the only thing is i want to pick image from simulator, so that i can extract db file and see what values are store in sqlite.db file.Is there any way to pick image form simulator or else can show sqlite.db file form real iphone device.