Challenge


#1

I got the drawing portion of the challenge working, but I decided to start over. For now I’m just making a generic array and trying to save and load it. The saving method gets called, but readFromData:ofType:error: is not even calling and I can’t figure out why. Here’s my code

- (id)init
{
    self = [super init];
    if (self) {
        ovals = [[NSMutableArray alloc] initWithObjects:@"test",@"test2",@"test3", nil];
        for ( NSString *string in ovals ) 
            NSLog(@"ovals contains: %@", string);
    }
    return self;
}
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
    NSLog(@"Saving...");
    if(ovals) NSLog(@"ovals exists");
    else NSLog(@"ovals doesn't exist");
    return [NSKeyedArchiver archivedDataWithRootObject:ovals];
}

- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
{
    NSLog(@"Loading..."); // Nothing gets logged to the console when I load a saved file..?
    ovals = [NSKeyedUnarchiver unarchiveObjectWithData:data];
    return YES;
}

Thanks for any help!


#2

I figured it out. I hadn’t configured an Exported UTI. I tried last night and even then it wasn’t working. Guess I need to be a little more tedious.