BMITime Sort problem


#1

[url]

/url]
When I run my program, I receive this error. I can not for the life of me figure it out. Any help is greatly appreciated.

Main.m Code

[code]//
// main.m
// BMITime
//
// Created by Christopher Smith on 5/25/12.
// Copyright © 2012 Sneaky Ferret inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import “Employee.h”
#import “Asset.h”
#import “Person.h”

int main (int argc, const char * argv[])
{

@autoreleasepool {
    
    
    //Create an array of Employee objects
    NSMutableArray *employees = [[NSMutableArray alloc]init ];
    
    for (int i = 0; i < 10; i++){
        //Create an istance of employee
        Employee *person = [[Employee alloc]init];
       
        
        //give the instance variable interesting values
        [person setWeightInKilos:90 + i];
        [person setHeightInMeters:1.8 - i/10.0];
        [person setEmployeeID:i];
        
        //put the employee in the employees array
        [employees addObject:person];
    }
    NSMutableArray *allAssets = [[NSMutableArray alloc] init];
    
    // Create 10 assets
    
    for (int i = 0 ; i < 10 ; i++) {
        // Create an asset
        Asset *asset = [[Asset alloc]init];
        
        //give it an interesting label
        NSString *currentLabel = [NSString stringWithFormat:@"Laptop %d",i];
        [asset setLabel:currentLabel];
        [asset setResaleValue:i * 17];
        
        //Get a random number between 0 and 9 inclusive
        NSUInteger randomIndex = random() % [employees count];
        
        //Find that employee
        Employee *randomEmployee = [employees objectAtIndex:randomIndex];
        
        //Assgin the asset to the employee
        [randomEmployee addAssetsObject:asset];
        
        [allAssets addObject:asset];
        
    }
    NSSortDescriptor *voa =[NSSortDescriptor sortDescriptorWithKey:@"valueOfAssets" ascending:YES];
    
    NSSortDescriptor *ei =[NSSortDescriptor sortDescriptorWithKey:@"employeeID" ascending:YES];
    [employees sortUsingDescriptors:[NSArray arrayWithObjects:voa,ei, nil]];
    
    NSLog(@"Employees: %@", employees);
    
    NSLog(@"Giving up ownership of one employee");
    
    [employees removeObjectAtIndex:5];
    
    NSLog(@"allAssets: %@", allAssets);
    
    NSLog(@"Giving up ownership of array");
    
    allAssets = nil;
    employees = nil;
    
}
sleep(100);
return 0;

}[/code][/url]


#2

This error looks like it is saying “Your Employee class has no valueOfAssets method”. Look at your Employee.m file and make sure the method is called “valueOfAssets” exactly.


#3

Thank you, I misspelled assets(asssets).


#4

I have an identical looking error message to DiEsmitty but I’ve checked all the method names and it looks right. Does anyone know of any other mistakes that would result in this issue?

Thanks a lot!