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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:08:50+00:00 2026-06-09T02:08:50+00:00

I have a UIButton subclass in which I set a property concert to a

  • 0

I have a UIButton subclass in which I set a property concert to a subclass of NSManagedObject. When I set this property, I am sure that the NSManagedObject is not null and that it’s properties aren’t null. Also, the data of the object shows the correct data.

When using the concert later when the button is clicked and sent to the method as sender, I will cast the sender to my subclass of UIButton and the properties of the concert will now return null but the concert itself is not null. Also, the data will be fault.

Does anyone know why this happens and how I can fix this?

Here, I initialize my button:

NFConcertButton *button = [NFConcertButton buttonWithConcert:concert tileSize:self.tileSize];

In initWithButton:tileSize: (which is called by the static method) I store the concert for later use.

- (id)initWithConcert:(NFConcert *)concert tileSize:(CGSize)tileSize
{
    if (self = [super init])
    {
        // Store concert
        _concert = concert;

       /*
         <NFConcert: 0xde67eb0> (entity: Concert; id: 0xde63f60 <x-coredata://F027F762-2F30-4A43-898B-42ECC199DE97/Concert/p2> ; data: {
           band = "SomeBand";
         })
        */

        // concert is not null
        // concert.band is not null

        // .... //
    }

    return self;
}

When the button is pressed, the below method is called and the properties of concert are now null.

- (void)concertButtonPressed:(id)sender
{
    NFConcert *concert = ((NFConcertButton *) sender).concert;
    // <NFConcert: 0xde67eb0> (entity: Concert; id: 0xde63f60 <x-coredata://F027F762-2F30-4A43-898B-42ECC199DE97/Concert/p2> ; data: <fault>) => (null)
    // concert is not null.
    // concert.band is now null.
}

UPDATE:

If I fetch the NSManagedObject again using the objectId, I will get the data and the properties will not return null. I don’t understand why this would be necessary. Can anyone tell me?

The below will work.

NFConcert *concert = ((NFConcertButton *) sender).concert;
concert = (NFConcert *) [managedObjectContext existingObjectWithID:concert.objectID error:nil];
  • 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-09T02:08:51+00:00Added an answer on June 9, 2026 at 2:08 am

    Using Apples default implementation of the Core Data stack, I no longer have this issue.
    I believe this issue was caused by DataManager which I used to work with the Core Data stack.

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

Sidebar

Related Questions

I have a UIbutton title that I set with [[buttons objectAtIndex:selectedButtonTag] setTitle:file forState:UIControlStateNormal]; This
I have a UIViewController subclass which has the view property set to a UIScrollView
I'd like to subclass UIButton to add some properties that i need (not methods...
I have a very simply subclass of UIButton that will fire off a custom
I have created a custom UIButton (UIButton subclass) for my application. Within this button's
I have a UIButton (a subclass of one, actually) that interacts with the user
I have a button that glows in my app (subclass of UIButton). To animate
I have a method that takes a UIButton, modifies its properties and returns a
I have a custom button which is my own subclass of UIButton . It
I have a UIButton that I create in my sub class ViewController, and add

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.