【发布时间】:2011-09-05 17:37:56
【问题描述】:
我在我的应用程序中使用 Coredata 保存了一张图片。然后我在另一个项目中导入了 Sqlite 文件并检索了该 Blob 字段并转换为 NSData。然后我在尝试将此 NSData 转换为 UIImage 时得到一个 NULL 值。
NSData *data=UIImageJPEGRepresentation(tempImage, 1.0);
通过保存上下文保存了以上数据
从 Sqlite 返回 ::
const char *sqlStatement = "select ID,NAME,IMAGE from CALL";
sqlite3_stmt *compiledStatement;
NSData *data=[[NSData alloc] initWithBytes: sqlite3_column_blob(compiledStatement, 2) length:sqlite3_column_bytes(compiledStatement, 2)];
UIImage * showImage= [UIImage imageWithData: data];
【问题讨论】:
标签: iphone sqlite uiimage blob