Attributed text in UITextView causing a crash

cocoa-touch, ios, nsattributedstring, uitextview

Solution

I had to use the `attributedText` property of `UITextView`:

self.textView.attributedText = [array objectAtIndex:self.appDelegate.selectedCell];

Problem

This is my code to display an attributed string in a UITextView ``` NSMutableAttributedString *recipeString =[[NSMutableAttributedString alloc]init]; [recipeString appendAttributedString:string1]; [recipeString appendAttributedString:string2]; [array addObject:recipeString]; ``` This code is inside a `for` loop. `string1` and `string2` are `NSMutableAttributedString`s. After that: ``` self.textView.text = [array objectAtIndex:self.appDelegate.selectedCell]; ``` The text view is an `IBOutlet`. It crashes with this exception: ``` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteAttributedString _isCString]: unrecognized selector sent to instance 0x8e866f0' ``` Any ideas on how to fix this crash?

Original source