Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Creating Plugins    basic get/set question
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Journeyman
Posted
Alright, I'm getting into the plug-in angle now. I've got a basic question (well, a few really) but this is a start.

Say I want to change the name of an appointment (I do). I am able to retrieve the existing name, but trying to set a new name is giving me a

[<GWTimeblock 0x6946bc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key activityName.

relevant code:

NSArray *timeblock_objects = [sender valueForKey:@"Objects"]; // only timeblock objects should be available to us
NSEnumerator *e = [timeblock_objects objectEnumerator];
id obj = nil;

while (obj = [e nextObject])

{
MCPObjectContext *oc = [obj objectContext]; // not necessary to get, but to set? Is context implicit in plugins?

NSString *currentApptTitle = [obj valueForKey:@"activityName"]; // gets current timeblock act name fine
NSString *myNewName = @"Hi Everybody! (Hi, Dr Nick!)";

[obj setValue:myNewName forKey:@"activityName"]; // nope, undefined key error.. hmm

[oc saveChanges];
}

So I imagine there is an easy answer... Or activityName really isn't compliant?

Thanks!
-E
 
Posts: 96 | Location: San Francisco | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
AJ
Marketcircle Team
Picture of AJ
Posted Hide Post
That's a good one.

What we've done here, is implement what is called an 'informal read-only protocol'. It is used in read-only places. For example, that protocol was done for the activity tab and the reminder window. Those guys show data and do not edit the data directly - hence we didn't add the 'set' equivalents. I guess we should mark those in the API somehow and truth be told - I didn't even think about that until I saw your post. It never crossed my mind.

So the answer is indeed easy. Use:
setValue:@"my whatever" forKey:@"subject"  
 
Posts: 890 | Location: Toronto | Registered: May 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Journeyman
Posted Hide Post
Ok, good to know. Thank you AJ.
 
Posts: 96 | Location: San Francisco | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Creating Plugins    basic get/set question

© Copyright 2006 Marketcircle Inc. All rights reserved.