Why does Cocoa return an empty string occasionally?

后端 未结 2 1661
春和景丽
春和景丽 2021-01-06 02:52

I have some code in my application that looks something like this:

char *hash = (char*) sqlite3_column_text(get_bookmark, 0);
NSString* postHash = [NSString          


        
2条回答
  •  礼貌的吻别
    2021-01-06 03:30

    I finally found the solution to this. I'm going to give Peter the accepted answer as he is right but the reason that I was getting an empty string is... interesting.

    The database is populated correctly. The query is also correct. The difference between my phone and my users is that they have jail broken handsets. And apparently jail broken iPhones sometimes use a different version of SQLite than found in shipping versions of iPhone OS.

    The change in version exposed a bug in my code that caused one of the parameters to be set incorrectly and sqlite3_column_text to return an empty string.

提交回复
热议问题