Automatic Reference Counting Issue

I just started following the Core Data Tutorial for iOS and wanted to apply Core Data to an existing project.  I got up to a point where I was init-ing my NSManagedObjectModel.  I started to get some errors that didn’t make sense right away.

Automatic Reference Counting Issue
Receiver ‘NSManagedObjectModel’ for class message is a forward declaration

I discovered that this error really means I’m missing an #import of some CoreData stuff.  To fix the problem I simply add the following line to /Supporting Files/projectName-Prefix.pch.

#import <CoreData/CoreData.h>

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s