从 sqlite 数据库加载数据错误。 “符号不同”
我在将 SQLite 数据库中的数据加载到详细视图中时遇到问题。该表显示正确,加载详细视图时应用程序崩溃并返回以下警告;
传递“stringWithUTF8String:”参数 1 时的指针目标符号不同,
这是什么意思以及如何解决此问题。请帮忙。这是我的代码。
if (SQLITE_DONE != sqlite3_step(detailStmt)) {
const unsigned char *db_text = sqlite3_column_text(detailStmt, 2);
NSString *address = [NSString stringWithUTF8String: db_text]; //error here!
self.ClubAddress = address;
}
else
NSAssert1(0, @"Error while getting the address of club. '%s'", sqlite3_errmsg(database));
sqlite3_reset(detailStmt);
isDetailViewHydrated = YES;
}
I'm having trouble loading data from sqlite database into a detailed view. The table displays correctly and when loading detailed view the app crashes and returns the following warning;
pointer targets in passing argument 1 of 'stringWithUTF8String:' differ in signedness
What does this mean and how do i fix this. Help please. Here is my code.
if (SQLITE_DONE != sqlite3_step(detailStmt)) {
const unsigned char *db_text = sqlite3_column_text(detailStmt, 2);
NSString *address = [NSString stringWithUTF8String: db_text]; //error here!
self.ClubAddress = address;
}
else
NSAssert1(0, @"Error while getting the address of club. '%s'", sqlite3_errmsg(database));
sqlite3_reset(detailStmt);
isDetailViewHydrated = YES;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当
stringWithUTF8String:
需要char *
时,您正在传递一个unsigned char *
——可能需要在第 2 行删除 unsigned 修饰符片段。You are passing in an
unsigned char *
whenstringWithUTF8String:
expects achar *
-- may want to drop the unsigned modifier on line 2 of your snippet.