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 9167951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:30:55+00:00 2026-06-17T15:30:55+00:00

I use a database called db.sqlite for my iPhone App. For finding the correct

  • 0

I use a database called db.sqlite for my iPhone App.
For finding the correct path I use the following code:

- (NSString *) filePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [[paths objectAtIndex:0] stringByAppendingPathComponent:@"db.sqlite"];

}

This returns the following Path:

/Users/*******/Library/Application Support/iPhone Simulator/6.0/Applications/E1D5F78D-7FD2-45D7-A3DE-B53BCBB9BDC5/Documents/db.sqlite

But the database at this path is newly created and empty.
When returning the right path as a string it works well, but I don’t think this will work on the iPhone.

return @"/Users/*******/workspace/xcode/MyApp/MyApp/db.sqlite";

What did I do wrong or forgot doing?

  • 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-06-17T15:30:56+00:00Added an answer on June 17, 2026 at 3:30 pm

    The code you posted is for getting a file from the app’s Documents sandbox directory. Based on the path you want, you need to get the file from the app’s resource bundle.

    NSString *path = [[NSBundle mainBundle] pathForResource:@"db" ofType:@"sqlite"];
    

    Keep in mind that your db.sqlite file is read-only inside the app bundle. Do not make any attempt to write to this database file.

    If you need to write to the database, you must first copy the file to a writable location (such as the Documents directory). Then use that copy of the file for all reading and writing.

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

Sidebar

Related Questions

I use the code below to insert data into my sqlite-database but for some
I'm having some trouble searching a SQLite database in my Android app. I use
To update a value in my SQLite database (android) I use following method. The
To access a remote database, I first have to use a program called Shrew
when we use sqlLite database for our projects does the path of .db file
What components can I use to use SQlite database with Delphi 6?
I have just learned how to use the SQLite database for local storage in
I have created a widget application, in which I use SQLite database object which
I use sqlite transaction in Android: SQLiteDatabase database = sqlite_helper.getWritableDatabase(); database.beginTransaction(); ... database.setTransactionSuccessful(); database.endTransaction();
I'm trying to use a SQLite db in my android app. It used to

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.