My app is crashing intermittently for users, but unfortunately I am not able reproduce the problem on any of my devices. The reported error is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteAttributedString initWithString:: nil value'
The log trace is not clear about the crash source. I have attached a log trace. I'm looking for any pointers that can help me to track this down.
The reason for the crash is in your title...
reason: 'NSConcreteAttributedString initWithString:: nil value'
It looks like you are trying to create an attributed string from a string but that string is nil.
Add a guard before you do you NSAttributeString initWithString to make sure the string isn't nil ie
if (string) {
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithAttributedString:string];
//other code etc...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.