如何清除错误“[NSString stringWithUTF8String:]:NULL cString'&quot ;? [英] how to remove error "[NSString stringWithUTF8String:]: NULL cString' "?

查看:1769
本文介绍了如何清除错误“[NSString stringWithUTF8String:]:NULL cString'&quot ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立 sqlite3 test3.sql 数据库,
将表格设为

I am making an sqlite3 test3.sql database, making table as

CREATE TABLE rest (name VARCHAR(100), price VARCHAR(100));

表已成功创建,但现在当我使用方法插入和检索数据时, ,,,

table is successfully created but now when I am using a method for inserting and retrieving data, then getting error,,,

错误在线

NSString *str = [NSString stringWithUTF8String:
                 (char *)sqlite3_column_text(compiledStatement, 1)];

错误是 + [NSString stringWithUTF8String:]:NULL cString' code>

the error is +[NSString stringWithUTF8String:]: NULL cString'

这个错误是什么,我该如何移除?

What is this error, how can I remove it?

推荐答案

而不是只有

... = [NSString stringWithUTF8String:
       (char *)sqlite3_column_text(compiledStatement, 15)]

您要使用

... = ((char *)sqlite3_column_text(compiledStatement, 15)) ? 
      [NSString stringWithUTF8String:
       (char *)sqlite3_column_text(compiledStatement, 15)] : nil;

这篇关于如何清除错误“[NSString stringWithUTF8String:]:NULL cString'&quot ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆