У меня есть следующий код. , ,бросать обычай исключение в объекте c
@try
{
NSArray * array = [[NSArray alloc] initWithObjects:@"1",@"2",nil];
// the below code will raise an exception
[array objectAtIndex:11];
}
@catch(NSException *exception)
{
// now i want to create a custom exception and throw it .
NSException * myexception = [[NSException alloc] initWithName:exception.name
reason:exception.reason
userInfo:exception.userInfo];
//now i am saving callStacksymbols to a mutable array and adding some objects
NSMUtableArray * mutableArray = [[NSMUtableArray alloc]
initWithArray:exception.callStackSymbols];
[mutableArray addObject:@"object"];
//but my problem is when i try to assign this mutable array to myexception i am getting following error
myexception.callStackSymbols = (NSArray *)mutableArray;
//error : no setter method 'setCallStackSymbols' for assignment to property
@throw myexception;
}
, пожалуйста, помогите исправить это, я хотел добавить дополнительные объекты в callStackSymbols. , , . Заранее спасибо
Не пытайтесь восстанавливаться из-за исключения. Исключения в iOS и OS X следует рассматривать как неустранимые, фатальные, ошибки программиста. – bbum