2012-08-07 75 views

回答

1

對於CLRegion的實體屬性類型,選擇「Transformable」然後定義Core Data爲您生成的NSManagedObject中的對象。 (見下面的位置)

@interface Person : NSManagedObject 
{ 
} 

@property (nonatomic, retain) NSString * firstName; 
@property (nonatomic, retain) NSString * lastName; 

@property (nonatomic, retain) CLRegion * location; 

@end 

@implementation Person 

@dynamic firstName; 
@dynamic lastName; 

@dynamic location; 

@end 
+0

感謝您的快速回復。我已經嘗試過,實際上,我得到這個錯誤:未知的類型名稱'CLRegion'和另一個:具有'保留(或強)'屬性的屬性必須是對象類型。 – ChickensDontClap 2012-08-07 18:54:47

+0

Duh沒有導入CoreLocation。這只是尷尬。非常感謝! – ChickensDontClap 2012-08-07 19:00:28

+0

耶!另一個選擇是這樣做的:http://samsoff.es/posts/archiving-objective-c-objects-with-nscoding然後將它們存儲爲「二進制數據」 – Kibitz503 2012-08-07 19:03:29