美文网首页iOS错误&解决
关于was mutated while being enumer

关于was mutated while being enumer

作者: AgoniNemo | 来源:发表于2016-08-27 11:38 被阅读350次

    提示信息:*** Terminating app due to uncaught exception

    ‘NSGenericException’, reason: ‘*** Collection <__NSArrayM:

    0xb550c30> was mutated while being enumerated.’

    出现这个问题就是你一边便利数组,又同时修改这个数组里面的内容而导致的

    解决方法有很多:

    1.创建一个临时的数组,把你要修改的数组的数据拷贝过去,用临时数组遍历。

    2.用enumerateObjectsUsingBlock方法;

    我是用第二种方法的

    相关文章

      网友评论

        本文标题:关于was mutated while being enumer

        本文链接:https://www.haomeiwen.com/subject/qqttettx.html