这真的很奇怪……
我运行我的应用程序,当它打开并且正在构建视图时,我得到:
Collection <CALayerArray: 0x124650> was mutated while being enumerated.
代码跟踪通过以下方式:
main
UIApplicationMain
-[UIApplication _run]
CFRunLoopRunInMode
CFRunLoopRunSpecific
_UIApplicationHandleEvent
-[UIApplication sendEvent:]
-[UIApplication handleEvent:withNewEvent:]
-[UIApplication _runWithURL:sourceBundleID:]
-[UIApplication _performInitilizationWithURL:sourceBundleID:]
-[AppDelegate applicationDidFinishLaunching:]
+[Controller initializeController] //This is my own function
[window addSubview: pauseMenuController.view] //This is the last point of my code it goes through
-[UIView(Hierarchy) addSubview:]
-[UIView(Internal) _addSubview:positioned:relativeTo:]
-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:]
-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
_NSFastEnumerationMutationHandler
objc_exception_throw
我已经运行了很多很多次游戏,但我从未见过这个,然后它突然出现了。奇怪的是,在所有代码都被调用之前,我没有创建任何其他线程(我知道) 。如果有人可以解释一下在 UIView 中访问它时可能会被修改的内容,那么我调试它会更容易。它是否与在视图中添加一些东西有关,而它已经添加了一些东西,也许?有任何想法吗?