I am using given below code to add NSMutableParagraphStyle to a lable, but this code runs fine on iOS7 but gives error on iOS 6. I had also added check but still it crashes the app.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSAttributedString invalid for autoresizing, it must have a single spanning paragraph style (or none) with a non-wrapping lineBreakMode.'
if ([_precherDetailLabel respondsToSelector:@selector(setAttributedText:)] && NSClassFromString(@"NSMutableParagraphStyle")!=Nil)
{
@try {
NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init];
[paragrahStyle setLineSpacing:3];
NSMutableAttributedString *attributedString=[[NSMutableAttributedString alloc] initWithString:string];
[attributedString addAttribute:NSParagraphStyleAttributeName
value:paragrahStyle
range:NSMakeRange(0, attributedString.length)];
_precherDetailLabel.attributedText=attributedString;
}
@catch (NSException *exception) {
NSLog(@"exception # 2324 %@",exception);
}
}