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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:34:29+00:00 2026-05-22T14:34:29+00:00

i use this library: https://github.com/jwang/activerecord-fetching-for-core-data – (NSManagedObjectModel *)managedObjectModel { if (managedObjectModel != nil) {

  • 0

i use this library: https://github.com/jwang/activerecord-fetching-for-core-data

- (NSManagedObjectModel *)managedObjectModel {
    if (managedObjectModel != nil) {
        return managedObjectModel;
    }
    NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"BranchData" ofType:@"momd"];
    NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
    managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];    
return managedObjectModel;

}

///////

[NSManagedObjectModel setDefaultManagedObjectModel:self.managedObjectModel];
[ActiveRecordHelpers setupCoreDataStackWithStoreNamed:@"BranchData.sqlite"];


NSManagedObjectContext *context = [NSManagedObjectContext context];
[NSManagedObjectContext setDefaultContext:context];


NSLog(@"%i", [[DataBranch findAll] count]);

DataBranch *branch = [DataBranch createEntity];

NSLog(@"%i", [[DataBranch findAll] count]);

[[NSManagedObjectContext context] save];

It works the logs prints out 0 and then 1
But if i restart my application it is not saved into the sqlite. and all data is lost
what do i do wrong ?

  • 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-22T14:34:30+00:00Added an answer on May 22, 2026 at 2:34 pm

    I confused the context i needed to save to the defaultContext and not the context as it woul create a new one

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

Sidebar

Related Questions

I tried to use this on my class library mylib.core.data.dll and got a successful
I would like to use this source: https://github.com/mongodb/casbah How can I use this stuff?
I'm going to use django-threadedcomments library at my Django project. https://github.com/HonzaKral/django-threadedcomments The tutorial gives
I want to try this module https://github.com/creationix/nstore fore simple storage . But when i
I'm trying to use the TouchListView made available here: https://github.com/commonsguy/cwac-touchlist . It's an Android
I'm trying to use the JSONKIt found here https://github.com/johnezang/JSONKit to parse through a JSON
I recently moved a project on github and I still use this library in
I am using open-ssl source given at https://github.com/eighthave/openssl-android to build a library which can
https://github.com/JakeWharton/Android-ViewPagerIndicator I'm trying to include that library/project into my workspace, however nothing shows up
I'm trying to use the jasmine-jquery plugin: https://github.com/velesin/jasmine-jquery . In the documentation it says

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.