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

The Archive Base Latest Questions

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

I have an entity Word, and the are two properties in it – inputSound

  • 0

I have an entity “Word”, and the are two properties in it – inputSound and outputSound,both of them are little,about 10KB audio files, but there would be 4000 instances od this entity in my SQL database.

First, i tried to store them as a binary data in my SQL, and it made it work quite slow.
So then i found an option to “Store in External Record File” and i want to ask,if this would help me,or i should better just store url to the audio file in my entity property?

If first is better, how should i move my pesistent store from Bundle to documents directory at the first launch?

Right now i’m just coping an SQL(it’s prepopulated by me in the developer’s part of my app),but how should i do that with so many files?And can i do that in backgrouns somehow to make my first launch faster and more user-friendly?

This is how i do it now

- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{

if (__persistentStoreCoordinator != nil)
        return __persistentStoreCoordinator;

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                         [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
NSString *defaultStore = [documentsDirectory stringByAppendingPathComponent:@"Easy10.sqlite"];

NSString *sqliteInBundle = [[[NSBundle mainBundle] pathForResource:@"Easy10" ofType:@"sqlite"]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Easy10.sqlite"]; 
NSError *error =nil;
NSFileManager *fileManager = [NSFileManager defaultManager];

if (![fileManager fileExistsAtPath:defaultStore])
    [fileManager copyItemAtPath:sqliteInBundle toPath:defaultStore error:&error];



__persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
[__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error];    
return __persistentStoreCoordinator;

}

  • 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-31T12:53:29+00:00Added an answer on May 31, 2026 at 12:53 pm

    For binary (and especially large ones, though your case of “many” of them can also apply) the recommended method seems to be to use Core Data to store the metadata, including a file path to the actual binary itself. Thus you’d store these things somewhere in the Application’s sandbox (i.e., perhaps a subdirectory of your creation in the “Documents” directory). Then you can use the [NSData dataWithContentsOfFilePath] or similar to actually get the bytes when you want to play them, but your Core Data fetches aren’t slowed down by trying to shovel those bytes around.

    Definitely take a look at the WWDC video on optimizing Core Data. Great examples of how to use Instruments and additional “SQL Debug Timing” switches to make sure that what you’re optimizing… actually got optimized. 🙂

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

Sidebar

Related Questions

I have two entity classes annotated in the following way @Entity class A {
I have entity called Customer and it has three properties: public class Customer {
I have entity Recipes and it has a HasMany collection comments. In a MVC
I have Entity Framework entities Events which have an EntityCollection of RSVP. I want
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
In my business model I have Entity class (IPoint interface ) that has a
I have an entity that maps to an external oracle table which is one
I have an entity class that has a property with an underlying db column
I have an entity that has a state table associated with it. The state
I have an entity loaded by Hibernate (via EntityManager ): User u = em.load(User.class,

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.