NSMutableAttributedStrings - objectAtIndex:effectiveRange:: Out of bounds

感情迁移 提交于 2019-11-28 12:04:51

Your length is too long on worldRange. NSMakeRange takes two arguments, the start point and the length, not the start point and the end point. That's probably why you are getting confused about both problems.

NSRange has two values, the start index and the length of the range.

So if you're starting at index 6 and going length characters after that you're going past the end of the string, what you want is:

NSRange worldRange = NSMakeRange(6, length - 6);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!