Project in iOS7 no problem, but after upgrading iOS8, there are a lot of problems, one of which is traced to the use of nsmutableattributing problems.
There is a feature in the project: there is a string of strings, a different color for the character at the specified position, which is implemented using nsmutableattributedstring:
nsmutableattributedstring *attibuttionstr = [[nsmutableattributedstring alloc] initwithstring : str];
[Attibuttionstr addattribute:(nsstring *) nsforegroundcolorattributename
value: (ID) firstcolor. Cgcolor
Range:onerange];
It's normal to do this on the iOS7.
But iOS8 on top of the problem, the program crashes, prompting "
2014-09-23 13:30:50.224 recordforstudy[17993:413448] * * * terminating app due to uncaught exception ' Nsinvalidargumentexception ', Reason: '-[__nscftype set]: Unrecognized selector sent to instance 0x7fcbcba07090 '
”
Finally find out,
On iOS8, use value: (ID) firstcolor. Cgcolor will get an error,
Change to Value: (ID) firstcolor just fine.
[Attibuttionstr addattribute:(nsstring *) nsforegroundcolorattributename
value: (ID) firstcolor
Range:onerange];
That's good.
Summary: In iOS7 and before, value is written
1, (ID) firstcolor. Cgcolor
or write directly
2, (ID) firstcolor
It's all fine.
But in the iOS8 can only write 2, (ID) Firstcolor this style is correct
Nsmutableattributing related IOS7 upgrade iOS8 problems