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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:54:13+00:00 2026-05-27T20:54:13+00:00

Hoping someone can help a new iOS developer out – I have a ready

  • 0

Hoping someone can help a new iOS developer out – I have a ready made sqlite database called teamresults.db that I added to the project using “Add Files…” but when I’m using the below code I seem to be connecting/referencing an empty database instead of the one that’s added (on inspection through the terminal the database the simulator uses is 0mb in size where as the one I’ve added is around 3mb).

It seems like the application is creating an empty database but I can’t work out why? Any thoughts?

For reference I don’t get any error messages:

BOOL success;
dbName = @"teamresults.db";

NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
dbPath = [documentsDir   stringByAppendingPathComponent:dbName];

NSFileManager *fileManager = [NSFileManager defaultManager];

success = [fileManager fileExistsAtPath:dbPath];

if(success) {
    return;
}

NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:dbName];

[fileManager copyItemAtPath:databasePathFromApp toPath:databasePathFromApp error:nil];
  • 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-27T20:54:14+00:00Added an answer on May 27, 2026 at 8:54 pm

    There seems to be something wrong with this line of code:

    [fileManager copyItemAtPath:databasePathFromApp toPath:databasePathFromApp error:nil];
    

    The correct one would be:

    [fileManager copyItemAtPath:databasePathFromApp toPath:dbPath error:nil];
    

    You should copy database to sandbox path instead of resources path !!

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

Sidebar

Related Questions

I am hoping someone can help me out with a quick question I have
I'm really hoping someone can help me out here. I have a DataGrid in
I'm hoping someone can help. I have a page made up of 3 divs
I am new to iPhone programming so am hoping someone can help me out
im hoping someone can help me quickly with a question i have. As site
I am hoping someone can help me with a question i have relating to
Alright, I am hoping someone can help me out. I apologize up front that
I am out of ideas here, so I'm hoping someone can help. Here is
I am hoping someone can help me. I have a very simple question, but
I am hoping someone can help me. I have just started running xcode 4.01

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.