TOC | PREV | NEXT

Problem: Reading in old or new files requires knowing the version so that colors and other changed items can be read in correctly.
Solution:
Add versioning to your class, and test on initWithCoder:.
      
      #define OPEN_STEP_VERSION 400
      #define COL_FOR_VERS(x,v)      (v<OPEN_STEP_VERSION? \      [[x decodeNXColor]retain] : [[x decodeObject]retain])
      
      + (void)initialize
      {
            [self setVersion:OPEN_STEP_VERSION];
      }
      
      - initWithCoder:(NSUnarchiver *)unarchiver
      {
            int version = [stream versionForClassName:@"GroovyClass"];
            [super initWithCoder:unarchiver];
            groovyColor = COL_FOR_VERS(unarchiver,version);
            ...
      }
      
Problem:
Code which used to use Objects' perform:object:afterDelay:cancelPrevious: and casted the argument to an id - (such as passing a rect * like this: [myObject peform:@selector(zoom:) with:(id)&copyRect afterDelay:.01 cancelPrevious:YES]) will now crash heinously.
      
      

Solution: Wrap your rect into an object, or make it an IVAR and wrap your method with a cover method
      
      - (void)doZoom:sender { [self zoom:&copyRect]; }


TOC | PREV | NEXT
Match: Format:
Search:
Created by Stone Design's Create on 6/2/1997