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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:10:55+00:00 2026-05-21T03:10:55+00:00

i have a simple iphone project which contains a simple xcdatamodel that has a

  • 0

i have a simple iphone project which contains a simple xcdatamodel that has a single entity
with roughly 3 attributes..

i want to know if there is a way to programmatically add an attribute to an entity..
i.e. if the user presses an “add” button of some kind, a simple string attribute is added to the entity and saved..

If this is not possible could someone point me in the right direction..

  • 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-21T03:10:55+00:00Added an answer on May 21, 2026 at 3:10 am

    You can programmatically alter entities but you can’t alter a managed object model after it has been assigned to a managed object context so that makes it useless for any user defined alterations. In any case, you wouldn’t want to add entities programmatically because that would make your previously created persistent store file useless.

    If you want to create a more free-form , user extensible data model, you have to back out and make your entities more flexible by adding an optional relationship to another entity or entity inheritance group that can model additional data.

    For example: Suppose you have a contact list and you want to add free form fields to each contact. You would set up your entities like this.

    Contact{
        name:string
        phone:string
        userDefinedFields<-->>UserDefined.contact
    }
    
    UserDefined{
        name:string
        contact<<-->Contact.userDefinedFields
    }
    

    Whenever the user adds a new field, you create a new UserDefined object and add it the Contact.userDefinedFeilds relationship. You can flesh that out as needed. If you need more than one type of user defined field you should set it up like this:

    Contact{
        name:string
        phone:string
        userDefinedFields<-->>UserDefined.contact
    }
    
    UserDefined{
        name:string
        contact<<-->Contact.userDefinedFields
    }
    
    TextField:UserDefined{
        text:string
    }
    
    NumberField:UserDefined{
        numValue:Number
    }
    

    You can then drop in a TextField or NumberField object into the Contact.userDefinedFields as needed.

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

Sidebar

Related Questions

I have an iPhone app that shows a simple view (View 1) that has
I have a simple iPhone application which uses OpenGL ES (v1) to draw a
I have a simple iPhone application that is very similar to the Page Control
I have a very simple iPhone app that requires a random integer from 1-100.
I'm working on a very simple iPhone app, that in the end will have
I have developed a simple location aware iPhone application which is functionally working very
I am developing an iphone project in which I have to use Walrus S3
I've built an Xcode project which is an iPad and iPhone app that simply
So I created a simple project, which I can test as an iPhone app.
I have a very simple Core Data app which pretty much contains strings of

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.