Reputation: 1103
I have a class(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
Adn a category for it:
@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
In this category a have to instance methods:
- (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;
}
As you see i have to breakpoints there. Now, then i call those methods
#import "Place+Create.h"
-(void)someMethod
{
[self.place setLattitudeAndLongitudeByCoordinate:coordiante];
}
It never seem to reach those breakpoints inside the method setLattitudeAndLogitudeByCoordinate, and debug shows that it even doesn't call them! Why?
Upvotes: 0
Views: 763
Reputation: 27587
Is someMethod
ever reached? Check that using a breakpoint or an extra NSLog
at its head.
If not, then your problem is somewhere else as your program flow is different than you expected it to be.
If it is reached then self.place
obviously is nil
. That means you never initialized it and again, your program flow is different than you thought it would be.
Upvotes: 1