I am trying to work out what asset every emplyee owns and in main.m I cycle through all empolyee and each employee’s assets and try to access asset’s label:
[code]
for(BNREmployee *emp in employees){
NSLog(@“Employee %d owns the following assets:”,emp.employeeID);
for (BNRAsset *a in emp.asssets) {
NSLog(@"%@",a.label);
}
}
/code]
Problem seems to be accessing “emp.assets” only get me a null, although in the “BNREmployee.m” it should return with NSArray pointer, isn’t it?
I don’t know what I do wrong. Help.
for(BNREmployee *emp in employees){
NSLog(@"Employee %d owns the following assets:",emp.employeeID);
for (BNRAsset *a in emp.asssets) {
NSLog(@"%@",a.label);
}
}
Oops, I found out I have a typo. The original code’s “asssets” should be “assets”. And I made the same mistake in the interface file. That’s why an array was declared but no value was ever given. I didn’t pick this up because the compiler never flag any problem.