• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: Accessing a managedObject property from within an accessor of another property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Accessing a managedObject property from within an accessor of another property


  • Subject: Fwd: Accessing a managedObject property from within an accessor of another property
  • From: Brad Stone <email@hidden>
  • Date: Tue, 22 Feb 2011 09:13:49 -0600

FYI - my managedObject is defined as such:

@interface Note :  NSManagedObject
{
}

@property (nonatomic, retain) NSNumber * uid;
@property (nonatomic, retain) NSString * category;
@property (nonatomic, retain) NSNumber * isEncrypted;

@interface Note (CoreDataGeneratedPrimitiveAccessors)

- (NSString *)primitiveCategory;
- (void)setPrimitiveCategory:(NSString *)value;

@end


@implementation Note

@dynamic uid;
@dynamic category;
@dynamic isEncrypted;

- (NSString *)category
{


	NSString * tmpValue;

    [self willAccessValueForKey:@"category"];
    tmpValue = [self primitiveCategory];
    [self didAccessValueForKey:@"category"];

   if ([[self valueForKey:@"isEncrypted"] boolValue]) {
        //code to decrypt tmpValue
    }

    return tmpValue;
}

- (void)setCategory:(NSString *)value
{


    if ([[self valueForKey:@"isEncrypted"] boolValue]) {
        // code to encrypt tmpValue
    }


    [self willChangeValueForKey:@"category"];
    [self setPrimitiveCategory:value];
    [self didChangeValueForKey:@"category"];
}

- (BOOL)validateCategory:(id *)valueRef error:(NSError **)outError
{
    // Insert custom validation logic here.
    return YES;
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Accessing a managedObject property from within an accessor of another property
      • From: Uli Kusterer <email@hidden>
References: 
 >Accessing a managedObject property from within an accessor of another property (From: Brad Stone <email@hidden>)

  • Prev by Date: Accessing a managedObject property from within an accessor of another property
  • Next by Date: Re: Accessing a managedObject property from within an accessor of another property
  • Previous by thread: Accessing a managedObject property from within an accessor of another property
  • Next by thread: Re: Accessing a managedObject property from within an accessor of another property
  • Index(es):
    • Date
    • Thread