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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:07:44+00:00 2026-05-29T11:07:44+00:00

I can’t figure why db.sqlite can’t be found. I added it to the resource

  • 0

I can’t figure why db.sqlite can’t be found. I added it to the resource dir of the project. It is there.
Here is some code how I check for existing.

-(void)getDatabaseLocation
{
    NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *docsDir = [dirPaths objectAtIndex:0];

    // Build the path to the database file
   NSString *databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"db.sqlite"]];

   NSFileManager *filemgr = [NSFileManager defaultManager];
     if ([filemgr fileExistsAtPath: databasePath ] == NO)
     {
         NSLog(@"NO"); // It's say no when this method  is called.
     }
    else
    {   NSLog(@"YES");
    }
}

//EDIT
Now I check that the path in docsDir doesn’t exist.

  • 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-29T11:07:45+00:00Added an answer on May 29, 2026 at 11:07 am

    Of course it isn’t there. You must first copy the resource to the documents directory, like this:

    if (![filemgr fileExistsAtPath:databasePath])
    {
        [filemgr copyItemAtPath:[NSBundle.mainBundle pathForResource:@"db" ofType:@"sqlite"] toPath:databasePath error:nil]; 
    }
    

    EDIT: If you only need to do lookups on the database (no editing), then you can simply do this:

    databasePath = [NSBundle.mainBundle pathForResource:@"db" ofType:@"sqlite"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody shed some light on getDay() in Javascript please. Here datepicker is textbox
Can I have a project that has some parts written in c and other
Can somebody point me to a resource that explains how to go about having
can you recommend some good ASP.NET tutorials or a good book? Should I jump
Can you suggest some good MVC framework for perl -- one I am aware
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can anybody tell me a regular expression to use within some PHP to find
Can some one confirm me that only one UIWindow instance is possible in any
Can i get the source code for a WAMP stack installer somewhere? Any help
Can some one Guide me to work with these things... What is Model popup

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.