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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:11:01+00:00 2026-06-15T19:11:01+00:00

Helo, I’m still newbie with Core Data and suddenly stuck in these simple code:

  • 0

Helo, I’m still newbie with Core Data and suddenly stuck in these simple code:

Purchased* newItem=[NSEntityDescription insertNewObjectForEntityForName:@"Purchased" inManagedObjectContext:self.managedObjectContext];
[newItem setPurchasedDate:[NSDate date]];
[newItem setLastOpen:[NSDate date]];
if ([self.managedObjectContext save:&error])
{
   //do something if the save success
}

Well, from the code above I’ve Got an ‘NSInvalidArgumentException’, reason: ‘-[Purchased setPurchasedDate:]: unrecognized selector sent to instance. As we can see the exception is pointing at

[newItem setPurchasedDate:[NSDate date]];

and that is right. When I try to debug this code step by step, the program just abort when this message is invoked.

I wonder why, cause there is no wrong in my model and my Purchased class, I’ve checked it hundred times. I have tried to change the location of setting value by overwrite -(void)awakeFromInsert() method and it’s fire the same exception. Is anyone has a suggestion? thanks before.

  • 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-15T19:11:02+00:00Added an answer on June 15, 2026 at 7:11 pm

    Check this:

    Your managed object model’s Purchased entity has an attribute of type Date that is called purchasedDate, and another one called lastOpen.

    In your Purchased.h file you have

    @property (nonatomic, strong) NSDate *purchasedDate;
    @property (nonatomic, strong) NSDate *lastOpen;
    

    In your Purchased.mfile you have

    @dynamic purchasedDate;
    @dynamic lastOpen;
    

    Make sure you #import "Purchased.h" in the file where you create the new instance.

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

Sidebar

Related Questions

Helo, I had stuck with this problem. Just to make things simple i'll explain
Helo. Im developing an application that transferes data over bluetooth(with a flight recorder device).
What am I doing wrong here: class Helo { // main: generate some simple
Helo, I'm trying the bunch of code and it is giving null. Is there
Helo, i have the following code which should filter entities. Half of the code
Helo everyone I've create simple page with table and would like populate it with
Helo! I created flag for my chart: type : 'flags', showInLegend: false, data :
Helo, The following code loads a some google map directions in. For some reason
helo everyone This is a code from a book i have bought. It gives
Helo I use this code: cur = $('input:radio'); cur.wrap('<span class=customRadio></span>'); what i must to

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.