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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:21:44+00:00 2026-05-19T23:21:44+00:00

Using this guide I have created a static library (let’s call it AppCore )

  • 0

Using this guide I have created a static library (let’s call it AppCore) that can be shared between the Mac OS X and iOS versions of one app. This static library uses Core Data and the point of it is to share the model part and schema versioning between different implementations.

I created a NSPersistentDocument based project that will depend on this AppCore. In this project I added a reference to the .xcdatamodel file. Then I created a simple table view with add/remove buttons to edit an array of one entity type with the assisted “new core data entity” item. This created an instance of NSArrayController and the required bindings for the add/remove behaviour.

Now, everything seems to work fine when I’m using the default class for the Core Data entities (NSManagedObject) and I’m able to add new rows using the +/- buttons. However, when I change the entity implementation class to a custom one, I’m getting an error

Failed to create new object

This seems to come from the NSArrayController and it seems to be unable to instantiate the required entity. I can, however, create one in the NSPersistentDocument subclass by:

[NSEntityDescription insertNewObjectForEntityForName:@"SomeEntity" inManagedObjectContext:[self managedObjectContext]]

What confuses me is why the instance of NSArrayController can’t. If I understand correctly, the array controller is instructed to create an entity, not class and my guess is that the entities are created with the help of NSEntityDescription class. I could implement my own version of the array controller’s add: but then again, it might be that here something is fundamentally wrong. I haven’t touched the init:s and the custom entity class implementation is simply for convenience, to access the attributes directly.

I have tried changing the base SDK on the AppCore but without effect. Currently it uses the iOS version but I’m not sure how it should be. This is another question but if unrelated, I might ask it here on a separate question.

So, to summarize, why can’t the NSArrayController create an instance of this entity?

Thanks in advance.

Update

This works if I add the SomeEntity class from the AppCore to the dependent project as a reference. This is not the most usable way since modifications to the AppCore has to be propagated to the dependatnt projects also.

  • 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-19T23:21:45+00:00Added an answer on May 19, 2026 at 11:21 pm

    Bingo. I missed the “-ObjC” flag for the dependant project’s “other linker flags”. Now everything works like a charm.

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

Sidebar

Related Questions

I have this web application that i have created using Wicket, Guice and JPA.
Since I have started using this site, I keep hearing about the Boost library.
I found this guide for using the flash parameters, thought it might be useful
anyone have any experience using this? if so, is it worth while?
I'm using this code, to make a request to a given URL: private static
I am porting an Oracle function into Postgres PGPLSQL.. I have been using this
I have an iPhone app that is using CoreData. I recently made some minor
If you create a static library for iOS do you have to distribute the
I have created a setup project for a Windows Application developed using Visual Stduio
I need to draw a gridded image using opengl. I've read that images created

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.