Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6937455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:21:53+00:00 2026-05-27T12:21:53+00:00

I know that the simulator and the actual iOS hardware are not EXACTLY the

  • 0

I know that the simulator and the actual iOS hardware are not EXACTLY the same, but I’m starting to pull my hair out over this one. I have this code:

sqlite3 *database;
sqlite3_stmt *statement; 
int themeCount;

if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
{
    NSString *updateSQL = [NSString stringWithFormat: @"SELECT COUNT(*) FROM Theme"];
    const char *update_stmt = [updateSQL UTF8String];

    if(sqlite3_prepare_v2(database, update_stmt, -1, &statement, NULL) == SQLITE_OK){

        if(sqlite3_step(statement)==SQLITE_ROW) 
        {
            themeCount = sqlite3_column_int(statement, 0);
        }
    }
    sqlite3_finalize(statement); 
    sqlite3_close(database);
}

With the simulator, it works perfectly fine. Once I push it to my devices, it fails. I’ve broken it down and came up with the return code where it fails:

if(sqlite3_prepare_v2(database, update_stmt, -1, &statement, NULL) == SQLITE_OK)

If I change that line to capture the code (ie. int x = sqlite3_prepare_v2(…)) it returns 0 with the simulator, 1 with the device. What am I doing wrong here?!?!

Also, for the record, the CREATE statement for the Theme table is:

@"CREATE TABLE Theme (ThemeId INTEGER PRIMARY KEY, ThemeName TEXT, Available BIT);"

(My first thought is that it was case sensitive)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:21:54+00:00Added an answer on May 27, 2026 at 12:21 pm

    You are not opening the database you think you are opening. The sqlite3_prepare_v2 is the first statement that needs the schema to be present. I suspect your databasePath is incorrect.

    You can be more specific with sqlite3_open_v2 by omitting the SQLITE_OPEN_CREATE flag which is the default with sqlite3_open so you don’t notice that a new database is being created by the open call. See SQLite3 docs. With the result of

    sqlite3_open_v2([databasePath UTF8String], &database, SQLITE_OPEN_READWRITE, NULL)
    

    you will see that the database does not exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know that this question looks the same as other around here, but none
I know that it's a subject that can raise a lot of debate, but
I know that I should put all the html elements in body tag, but
I know that this has already been asked here but the answer (using a
I know that in iOS, background apps can only be running Finite-length tasks (10
i know that this question has been posted a lot of times but the
When testing my app, everything runs fine on the iOS simulator, but I experience
Do you know a JS library for DOM events simulation? I know that this
Does anyone know of a class/library/etc. that can simulate 32 bit unsigned integers on
I know that one of the differences between classes and structs is that struct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.