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

  • Home
  • SEARCH
  • 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 7062959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:39:25+00:00 2026-05-28T04:39:25+00:00

I’m new to Xcode and trying to learning myself, my problem may be naive

  • 0

I’m new to Xcode and trying to learning myself, my problem may be naive but I really need helps.
I’m learning creating an ebook by learning from a finished project with source code.
It works perfectly about recording bookmark through sqlite3.
But when I create a new project with different name and path, built pharse of libsqlite3.dylib correctly and copied almost everything of the code, the else statement is called and crashes when I’m trying to visit bookmark window.

Here’s some question I asked myself,

  1. did I miss anything, or failed on changing names or paths? answered: no.
  2. as the one runs perfectly and the other one with almost same code crashes, what’s the most possible mistake? answered: the very few differences from these two project,etc path, name, content in file.

Then I changed the database file name of the good project, and it becomes crashing.
I couldn’t believe, because I heard that sqlite3_open([dbPath UTF8String], &dataBase); will create file if it doesn’t exist, why won’t it just create a new file with the new name after it was told to access the new file?

Second test I did is manually changing the db file path of the new project to the db file path of the original one. like the path is no more [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; but it is @”/Users/~(path of the original one)~/Documents/archive” and omg it works.
But of course I can’t leave it like that cause that path means nothing on a real iPhone and it still depends the db file of the original one.

At least I know the path really matters and I seems really missing some thing like db file in my new project.
But the thing is I didn’t find any db file in the path of the original project, it seems exist and important, but doesn’t show in finder.

I even tried to copy the file to my new path programmaticlly, like calling [self createEditableCopyOfDatabaseIfNeeded]; with the new and the old path.
That’s all I tried so far.

The strange thing is it somehow record font and color after an unknown attempt, but still crashes on going to bookmark window.

That’s all I tried in three days. It may help you answer the question or at least know how I was upset after thousands attempts.
Waiting for help and thank you very much!

const char *createSQL = “CREATE TABLE IF NOT EXISTS BOOKMARK(pos REAL PRIMARY KEY,\fontsize REAL,\bookpath TEXT)”;

newly added: As the program automatically issue the crash when the database is not prepared, the error meg, as someone said, is useless. All I need is maybe making sqlite3_prepare(dataBase, [querySQL UTF8String], -1, &statement, nil) == SQLITE_OK not false..

  • 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-28T04:39:25+00:00Added an answer on May 28, 2026 at 4:39 am

    The SQL you’re using to create the table in the new DB appears to be messed up. Try removing the \’s

    Try this instead:

    const char *createSQL = "CREATE TABLE IF NOT EXISTS BOOKMARK(pos REAL PRIMARY KEY, fontsize REAL, bookpath TEXT)";
    

    Additionally you should take a look at what sqlite3_prepare actually returns. The SQLite documentation gives a list of error codes to check against. An example of logging the error code:

    int ret = sqlite3_prepare(dataBase, [querySQL UTF8String], -1, &statement, nil);
    if (ret != SQLITE_OK) {
        NSLog(@"Error calling sqlite3_prepare: %d", ret);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.