UIImageView发生奇怪的崩溃问题

时间:2013-09-19 06:41:27

标签: ios uiimageview nsautolayout

我有一个图像视图,在我的一个项目中从服务器加载后设置为图像。我看到一些时间崩溃,其中stacktrace看起来像这个

CoreFoundation 0x344d82a3 __exceptionPreprocess + 163   
libobjc.A.dylib 0x3c1bc97f objc_exception_throw + 31    
CoreFoundation 0x344d7d85 -[NSException name] + 1   
Foundation 0x34d78509 -[NSConcreteMapTable countByEnumeratingWithState:objects:count:] + 57 
CoreFoundation 0x34460d39 -[__NSFastEnumerationEnumerator nextObject] + 133 
CoreFoundation 0x34433f11 -[NSEnumerator countByEnumeratingWithState:objects:count:] + 49   
Foundation 0x34e88093 -[NSISEngine enumerateRows:] + 215    
Foundation 0x34e8dfdf -[NSISEngine description] + 123   
CoreFoundation 0x34448897 -[NSObject(NSObject) _copyDescription] + 35   
CoreFoundation 0x344b92db __CFStringAppendFormatCore + 11139    
CoreFoundation 0x34453fa9 CFStringCreateWithFormatAndArguments + 73 
CoreFoundation 0x344d8195 +[NSException raise:format:] + 57 
Foundation 0x34e8a11f -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 191   
Foundation 0x34e8c759 -[NSISEngine optimize] + 61   
Foundation 0x34e8c8af -[NSISEngine withAutomaticOptimizationDisabled:] + 211    
UIKit 0x36719c4f -[UIView(UIConstraintBasedLayout) removeConstraints:] + 283    
UIKit 0x362f6451 -[UIView(UIConstraintBasedLayout) invalidateIntrinsicContentSize] + 73 
UIKit 0x362f4f39 -[UIImageView setImage:] + 381 
MyApp 0x000ae369 -[DetailViewController didLoadImage:contextInfo:] (DetailViewController.m:1722)    
MyApp 0x00114a45 -[UTImageCache executeRequest:] (UTImageCache.m:296)   
Foundation 0x34deee85 __NSThread__main__ + 973  
libsystem_c.dylib 0x3c613311 _pthread_start + 309   
libsystem_c.dylib 0x3c6131d8 thread_start + 8

崩溃信息是

18-Sep-13 04:43:28 PM NSGenericException
* 收集在枚举时发生了变异。

我不确定这里有什么问题? Auto布局是否在此处出现任何问题。

由于

1 个答案:

答案 0 :(得分:1)

不,这不是自动布局。看来你有像

这样的东西
for (NSDictionary *dictionary in myAwesomeArray) {

}
你的代码中的

。如果迭代数组的内容,则不允许更改数组。这是您根据错误消息所做的事情。