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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:46:05+00:00 2026-06-15T12:46:05+00:00

I have an app that uses CoreData. I created NSManagedObjects for the two object

  • 0

I have an app that uses CoreData. I created NSManagedObjects for the two object types in CoreData. When I try to use the object and set a property on the object the compiler says “[User setUsername:]: unrecognized selector sent to instance”. It doesn’t matter what attribute I, [User setValue], try it always gives unrecognized?

User *joeBlow = [[User alloc] init];
[joeBlow setUsername:@"joeblow"];

OR
User *joeBlow = [[User alloc] init];
joeBlow.username = @”JoeBlow”;

both give “unrecognized selector sent to instance”

Below is my code for USER:

User.h

@interface User : NSManagedObject

  @property (nonatomic, retain) NSString * address1;
  @property (nonatomic, retain) NSString * username;
  @property (nonatomic, retain) NSString * zip;
  @property (nonatomic, retain) NSString * email;

@end

User.m

@implementation User

  @dynamic address1;
  @dynamic username;
  @dynamic zip;
  @dynamic email;

@end
  • 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-06-15T12:46:06+00:00Added an answer on June 15, 2026 at 12:46 pm

    You can’t create new instances of Core Data entities by the normal alloc–init pattern (unlike other classes). Instead, call a class method on NSEntityDescription:

    User *joeBlow = [NSEntityDescription 
                     insertNewObjectForEntityForName:@"User"
                     inManagedObjectContext:self.managedObjectContext];
    [joeBlow setUsername:@"joeblow"];
    

    See Apple’s Core Data Programming Guide for more information.

    Finally, note that [jb setUsername:@"jb"] and jb.username = @"jb" are the same – the latter is dot notation, a different way of expressing the former.

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

Sidebar

Related Questions

I have an app on the app store, that uses coredata as storage. I
Previously, I have an app that uses core data. I use same store url
I have an iPhone app that makes use of the AddressBook.framework and uses Core
I have an app that fetches data from the internet and uses CoreData to
i have an iphone app that uses coredata to store its contents. users often
I have developed an iOS app that uses CoreData/SQLite. It works, but now I
I have an OS X app that uses a splitview with two embeded NSTableViews.
I have a Mac (not document) app, that uses CoreData. When launching the app,
I have an app that uses the ActionBar with tabs in combination with Fragments.
I have an app that uses webView. In the home screen of a website

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.