• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data entity name issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data entity name issue


  • Subject: Re: Core Data entity name issue
  • From: Andreas Grosam <email@hidden>
  • Date: Thu, 05 Jul 2012 15:18:36 +0200

On 03.07.2012, at 04:12, Chuck Soper wrote:

> Juan and Robert, thanks. I think that I will adopt the following practice:
> before generating NSManagedObject subclass source files, add a prefix to
> the Entity class name by using the Data Model Entity inspector. When the
> NSManagedObject subclass source files are generated, the class and entity
> names will all be correct.
>
> This practice should avoid these kind of compile and run time errors. I
> was surprised that it took a couple of weeks for the errors to show up.

You may also benefit from the following:

Structure your source files and possibly third party source files into subfolders. You may put all your sources in a common subfolder, e.g."Sources".

Suppose, for your models choose a subfolder labeled "Models" located within "Sources":

MyProject
|-- Sources
    |-- Models
    |-- Views
    |-- Controllers
    |-- Network
    |-- …
|-- ThirdParty
    |-- JSON
|-- Resources
|-- …
...

Setup a header search path to the root folder of your sources: ${SRCROOT}/Sources

You may also add header search paths to other sub folders: ${SRCROOT}/ThirdParty

In your source files you can locate headers with a "qualified" import directives:

// TimeTableViewController.m   (located in Sources/Controllers)
#import "Models/Time.h"                 --> locates header via search path ${SRCROOT}/Sources
#import "Views/TimeCellView.h"
#import "TimeTableViewController.h"     --> locates header via "current directory"



// Persons.m     (located in Sources/Models)
#import "JSON/MyJSON.h"                --> locates header via ${SRCROOT}/ThirdParty
#import "Network/RESTOperation.h"
#import "Persons.h"                    --> locates header via "current directory"




Andreas
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: Core Data entity name issue (From: Chuck Soper <email@hidden>)

  • Prev by Date: Re: PowerPC and 10.5 "Base SDK"
  • Next by Date: Counterparts assistant, same file: class extensions
  • Previous by thread: Re: Core Data entity name issue
  • Next by thread: Serious Xcode bug with storyboards. Data loss.
  • Index(es):
    • Date
    • Thread