程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> nsdictionary-NSDictionary:第二個對象非零

nsdictionary-NSDictionary:第二個對象非零

編輯:編程綜合問答
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"]];


        }

最佳回答:


dictionary 裡面不能存放nil的值的.這個要注意.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved