如果出现问题,我正在尝试设置错误消息,但我得到了
This class is not key value coding-compliant for the key NSLocalizedDescription
这是我使用的代码
-(id)getMoneyFromAccount:(int) sum error:(NSError **)error
{
if(self.balance - sum < 0)
{
NSDictionary *details = [NSDictionary dictionary];
[details setValue:@"You don't have enough money" forKey:NSLocalizedDescriptionKey];
*error = [NSError errorWithDomain:@"money" code:200 userInfo:details];
return nil;
}
self.balance = self.balance - sum;
return [NSNumber numberWithInt:self.balance];
}