开发者

Core Data methods not in header file

开发者 https://www.devze.com 2023-02-22 04:44 出处:网络
Why shouldn\'t these methods be in the header file also? This was genereated by xcode btw. Interface @class Environment, Location;

Why shouldn't these methods be in the header file also? This was genereated by xcode btw.

Interface

@class Environment, Location;

@interface Log : NSManagedObject {
@private
}
@property (nonatomic, retain) NSDate * date;
@property (nonatomic, retain) NSString * time;
@property (nonatomic, retain) NSNumber * distance;
@property (nonatomic, retain) NSString * comment;
@property (nonatomic, retain) NSSet* locations;
@property (nonatomic, retain) NSSet* environments;

@end

Implementation

@implementation Log
@dynamic date;
@dynamic time;
@dynamic distance;
@dynamic comment;
@dynamic locations;
@dynamic environments;

- (void)addLocationsObject:(Location *)value {    
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"locations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"locations"] addObject:value];
    [self didChangeValueForKey:@"locations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)removeLocationsObject:(Location *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"locations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"locations"] removeObject:value];
    [self didChangeValueForKey:@"locations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)addLocations:(NSSet *)value {    
    [self willChangeValueForKey:@"locations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"locations"] unionSet:value];
    [self didChangeValueForKey:@"locations" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}

- (void)removeLocations:(NSSet *)value {
    [self willChangeValueForKey:@"locations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"locations"] minusSet:value];
    [self didChangeValueForKey:@"locations" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
}


- (void)addEnvironmentsObject:(Environment *)value {    
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"environments" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"environments"] addObject:value];
    [self didChangeValueForKey:@"environments" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)removeEnvironmentsObject:(Environment *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"environments" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"environments"] removeObject:value];
    [self didChangeValueForKey:@"environments" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)addEnvironments:(NSSet *)value {    
    [self willChangeValueForKey:@"environments" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"environments"] unionSet:value];
    [self didChangeValueForKey:@"environments" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}

- (void)removeEnvironments:(NSSet *)value {
    [self willChangeValueForKey:@"environments" withSetMutation:NSKeyValueMinusSetMutation usingObjects:开发者_JAVA百科value];
    [[self primitiveValueForKey:@"environments"] minusSet:value];
    [self didChangeValueForKey:@"environments" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
}


@end


Please see this question:

Xcode4: Different code generated for custom core data managed objects


they are generated at runtime by core data framework

0

精彩评论

暂无评论...
验证码 换一张
取 消