Core Data, Error when compiling


#1

HI,
In the core data chapter, page 323, I notice when I compiled it in xcode iOS 6: Error : thumbnail must have a defined type.!!

Any idea why?


#2

anyone?


#3

Sounds like you didn’t replace the UNKNOWN_TYPE in BNRItem.h


#4

No I do have that, I am getting an error about the miconfigured property though!!.

This my .H file
@interface BNRItem : NSManagedObject

@property (nonatomic, strong) NSString * itemName;
@property (nonatomic, strong) NSString * serialNumber;
@property (nonatomic) int32_t valueInDollars;
//@property UNKNOWN_TYPE UNKNOWN_TYPE thumbnail;
@property (nonatomic, strong) UIImage * thumbnail;
@property (nonatomic, strong) NSData * thumbnailData;
@property (nonatomic, strong) NSString * imageKey;
@property (nonatomic) NSTimeInterval dateCreated;
@property (nonatomic) double orderingValue;
@property (nonatomic, strong) NSManagedObject *assetType;

  • (void)setThumbnailDataFromImage : (UIImage *)image;

Is there some project setting that should enable to make this work?
I do have the source code from your website and I can compile chapter 16 source code fine, which why I am intrigued
as to know what setting or code piece I missed in my own project that is causing this.


#5

Hm, in the Core Data model file, have you selected the appropriate type for that property?


#6

I have the same problem/question. I changed the thumbnail Type to Binary Data and the error went away. However, the book (p.320) indicates to leave that as Undefined in the first place.

Is this due to SDK 6.0 or Xcode 4.5 which has now requires every Type to be defined in the Date Model?


#7

[quote=“niteox”]I have the same problem/question. I changed the thumbnail Type to Binary Data and the error went away. However, the book (p.320) indicates to leave that as Undefined in the first place.

Is this due to SDK 6.0 or Xcode 4.5 which has now requires every Type to be defined in the Date Model?[/quote]

My bad, missed the part that says to mark thumbnail as “Transient” …


#8

I had the same problem as I missed the following step

“Select thumbnail from the Attributes list and the open the “Data Model Inspector” . Check the box for the Transient attribute (see Figure 16.5 on page 320)”…

Following that instruction took care of the problem…