2011-12-01 50 views
0
2011-12-01 18:10:36.932 AVCam[3987:17903] *** -[UIImage _isResizable]: message sent to deallocated instance 0xdf7e360 

Current language: auto; currently objective-c 

守則是我目前得到這個崩潰日誌在控制檯:

UIImageView * firstView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 240)]; 
[firstView setContentMode:UIViewContentModeScaleAspectFill]; 
firstView.image = firstPhoto.photo; 
[firstBlock addSubview:firstView]; 
[firstView release]; 

有誰知道這是什麼意思?可能是什麼原因呢?

謝謝!

+0

你正在使用哪個iOS? –

+0

ios 5 @MisterJack已經幫我!非常感謝你! – pengfei

回答

2

的問題應該在這裏:

firstView.image = firstPhoto.photo; 

什麼是firstPhoto?它什麼時候發佈?我想它會在它變成UIImageView的內容之前被釋放。

你可能有送`[保留]`消息,是這樣的: firstView.image = [firstPhoto.photo保留];
+1

'UIImageView的'image'屬性被定義爲保留,所以我不確定''[firstPhoto.photo retain]'是否真的需要/或將有所幫助。但是你對「什麼是先攝影」的暗示?「應該有助於確定問題。也許它已經在'firstView.image = firstPhoto.photo;' – Mustafa

+0

之前被釋放/自動釋放,我同意,問題可能與firstPhoto.photo。如果你註釋掉該行,它可能不會崩潰? firstPhoto.photo如何創建等 – ader

+0

@Mustafa你說得對,'[retain]'消息是沒用的。 –