私はクラス(Core Data Generated)を持っています:
@interface Place : NSManagedObject
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSString * subtitle;
@property (nonatomic, retain) NSNumber * latitude;
@property (nonatomic, retain) NSNumber * longitude;
@end
@implementation Place
@dynamic title;
@dynamic subtitle;
@dynamic latitude;
@dynamic longitude;
@end
カテゴリを追加します。
@interface Place (Create)
+ (Place *)placeWithTitle:(NSString *)title
inManagedObjectContext:(NSManagedObjectContext *)context;
+(Place *) placeWithTitle:(NSString *)title andSubtitle:(NSString *)subtitle inManagedObjectContext:(NSManagedObjectContext *)context;
+(Place *) placeWithCoordinate:(CLLocationCoordinate2D) coordinate inManagedObjectContext:(NSManagedObjectContext *)context;
- (void) setLattitudeAndLongitudeByCoordinate:(CLLocationCoordinate2D) coordinate;
- (CLLocationCoordinate2D) coordinate;
@end
このカテゴリでは、メソッドをインスタンス化する必要があります。
- (void) setLattitudeAndLongitudeByCoordinate:(CLLocationCoordinate2D) coordinate
{
self.latitude=[NSNumber numberWithDouble:coordinate.latitude];//break point HERE
self.longitude=[NSNumber numberWithDouble:coordinate.longitude];
}
-(CLLocationCoordinate2D) coordinate
{
CLLocationCoordinate2D coord;//break point HERE
coord.latitude=[self.latitude doubleValue];
coord.longitude=[self.longitude doubleValue];
return coord;
}
ご覧のとおり、そこでブレークポイントを設定する必要があります。今、私はそれらのメソッドを呼び出します
#import "Place+Create.h"
-(void)someMethod
{
[self.place setLattitudeAndLongitudeByCoordinate:coordiante];
}
メソッド setLattitudeAndLogitudeByCoordinate 内でこれらのブレークポイントに到達することはないようであり、デバッグはそれらを呼び出していないことさえ示しています! なんで?