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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:39:38+00:00 2026-05-23T15:39:38+00:00

I have the following problem: As our app is going to be shown to

  • 0

I have the following problem:

As our app is going to be shown to potential customers it has to run offline in first version (due to dependencies to a backend that is not finished right now) and therefore all the data shown in the app will be retrieved by CoreData from a sqlite db.
As we want to avoid later refactoring we decided to put the CoreData entities behind protocols. A service will take care of all the data retrieval and hide the entities with the corresponding protocols.

In a later version of the app the UI developers will just switch the service to the backend one’s and do not have to alter the rest of their code due to sticking to the protocols. For UI developer it does not make a difference if the entities will be NSManagedObjects or just NSObjects.

And now comes the problem.
We have declared the protocols (set- and get-Methods) for all the entities in our app and generated CoreData entities that fit to those protocols. CoreData is using @dynamic for all the set/get-Methods (that will we be generated during runtime from the CoreData framework).

All the NSManagedObjects should now implement their corresponding protocols, but the compiler is giving out warnings (because of @dynamic) that the CoreData-Object is not implementing the protocol.

I just want to give you ONE entity and the corresponding protocol to explain my problem in detail:

TaskCD.h

@interface TaskCD : NSManagedObject<Task> {
@private
}
@property (nonatomic, retain) NSString * category;
@property (nonatomic, retain) NSNumber * frequency;
@property (nonatomic, retain) NSDate * validityEnd;
@property (nonatomic, retain) NSDate * validityStart;
@property (nonatomic, retain) NSNumber * periodicity;
@property (nonatomic, retain) NSString * descr;
@property (nonatomic, retain) NSNumber * selected;
@property (nonatomic, retain) NSSet* measurements;

@end

TaskCD.m

#import "TaskCD.h"
#import "MeasurementCD.h"

@implementation TaskCD
@dynamic category;
@dynamic frequency;
@dynamic validityEnd;
@dynamic validityStart;
@dynamic periodicity;
@dynamic descr;
@dynamic selected;
@dynamic measurements;

.... CoreData One-To-Many-stuff ....

@end

Task.h

@protocol Task <NSObject>

- (NSString*) getCategory;
- (void) setCategory:(NSString*) category;

- (NSNumber*) getFrequency;
- (void) setFrequency:(NSNumber*) frequency;

- (void) setValidityEnd:(NSDate *) date;
- (NSDate *) getValidityEnd;

- (void) setValidityStart:(NSDate *) date;
- (NSDate *) getValidityStart;

- (void) setPeriodicity:(NSNumber *) number;
- (NSNumber *) getPeriodicity;

- (void) setDescr:(NSString *) descr;
- (NSString *) getDescr;

- (void) setSelected:(NSNumber *) selected;
- (NSNumber *) getSelected;

- (void) setMeasurements:(NSSet*) measurements;
- (NSSet *) getMeasurements;

@end

I am not that experienced with ObjC and I am coming from Java Development. Maybe it is a design failure and not an ObjC issue. What we want to definitely stick with, is that in the productive version with the real backend the UI developer should NOT work with NSManageObject classes to keep away the CoreData stuff. He just sees one facade giving him an API to interact with the layers behind (First CoreData. Later REST backend). The UI developer should only see plain VOs or stick to protocols (interfaces).

I just want to know how to avoid those warnings. All proposals are welcome. 😉

Thanks in advance guys!!

  • 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-23T15:39:38+00:00Added an answer on May 23, 2026 at 3:39 pm

    One thing I can suggest off the bat: the accessors defined in Task.h should match the names of the @property declarations in the TaskCD interface. Instead of:

    - (NSString*) getCategory;
    

    you should declare it as:

    // this is the more common Obj-C naming convention
    - (NSString*) category;
    

    Alternately, specify the name of the “get” accessor in the @property declaration (in TaskCD.h):

    //meh... not so nice
    @property (nonatomic, retain, getter=getCategory) NSString * category; 
    

    Also IMHO, with Core Data you’re much better off using the dynamically generated accessors, rather than implementing your own.

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

Sidebar

Related Questions

We have following problem. Developers frequently need to make small changes to our web
I have got a serious problem running our web app in some machines.. machines
I'm using the following to get a help document in our app. My problem
I have the following problem: In our application we have a list of reports
For a couple of days we have problem with our app. We use SoapHttpClientProtocol
On the current project I'm working on, we have the following problem. Our software
I have following problem: when my session expires and user clicks on Ajax.Actionlink, Logon
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have 2 Strings of DNA Sequences (consisting 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.