shrimp-hamburger 2013-08-22 09:15 采纳率: 0%
浏览 3449
已采纳

NSDictionary:第二个对象非零

在NSDictionary 中捆绑数据时崩溃日志:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSDictionary dictionaryWithObjectsAndKeys:]: second object of each pair must be non-nil.  Or, did you forget to nil-terminate your parameter list?'
*** First throw call stack:

代码:

 while(sqlite3_step(select_statement) == SQLITE_ROW)

    {

//            const char* recipeID = (const char*)sqlite3_column_text(select_statement, 1);
//            const char* recipename = (const char*)sqlite3_column_text(select_statement, 0);
//            const char* recipepicname = (const char*)sqlite3_column_text(select_statement, 3);
//            const char* chapterid = (const char*)sqlite3_column_text(select_statement, 4);
//            const char* recipedesc = (const char*)sqlite3_column_text(select_statement, 2);
//            
//            
//             srtRecipestepId = recipeID == NULL ? nil : [[NSString alloc]initWithUTF8String:recipeID];
//             strRecipeName = recipename == NULL ? nil : [[NSString alloc]initWithUTF8String:recipename];
//             NSString *recipePicName = recipepicname == NULL ? nil : [[NSString alloc]initWithUTF8String:recipepicname];
//             strRecipeIntro = recipedesc == NULL ? nil : [[NSString alloc]initWithUTF8String:recipedesc];
//             NSString *strchapterId = chapterid == NULL ? nil : [[NSString alloc]initWithUTF8String:chapterid];

            srtRecipestepId=[NSString stringWithUTF8String:(char *)sqlite3_column_text(select_statement, 1)];
            strRecipeName=[NSString stringWithUTF8String:(char *)sqlite3_column_text(select_statement, 0)];
           // RecipestepPics = [[NSData alloc] initWithBytes:sqlite3_column_blob(select_statement, 3) length:sqlite3_column_bytes(select_statement, 3)];
           NSString *recipePicName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(select_statement, 3)];
            strRecipeIntro = [NSString stringWithUTF8String:(char *)sqlite3_column_text(select_statement, 2)];
            NSString *strchapterId = [NSString stringWithUTF8String:(char *)sqlite3_column_text(select_statement, 4)];

            [arrreturnRecipefinder addObject:[NSDictionary dictionaryWithObjectsAndKeys:srtRecipestepId,@"RecipestepId",strRecipeName,@"RecipeName",recipePicName,@"RecipestepPics",strRecipeIntro,@"RecipeIntro",strchapterId,@"RecipeChapterId"]];


        }
  • 写回答

1条回答 默认 最新

  • JentCastttttt 2013-08-27 13:13
    关注

    dictionary 里面不能存放nil的值的.这个要注意.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记