2010-08-26 132 views
0

從通訊簿獲取數據時出現此異常。我已通過互聯網檢查,但沒有得到任何幫助。從地址簿獲取數據時出現異常

溢出分配位圖後備存儲。無法背部位圖,每行320字節,-2147483648高度和1架飛機

我正在使用AddressBook Framework從地址簿中獲取數據。這是內存問題還是因爲獲取了我在Addressbook聯繫人中設置的化身信息。

請幫忙。如果有任何建議或建議,那麼請給它...

回答

1

感謝您的回覆

正如你所說,我已經檢查的所有代碼繪製大型的圖像或視圖。並找到了我用於調整圖像大小的以下功能。現在調整圖像大小將在服務器端完成。我對這個問題有更多疑問。你可以在下面的代碼塊中檢查它。現在從客戶那裏等待這個問題。

再次感謝您的幫助。

-(NSData *)getCompressedImageDataFromData:(NSData *)imData 
{ 
    NSImage *pImage = [[[NSImage alloc] initWithData:imData] autorelease]; 
NSSize orgSize = [pImage size]; 
int widthInput, heightInput; 
widthInput = orgSize.width; 
heightInput = orgSize.height; 
if(widthInput <= 72 && heightInput <= 72) 
    return imData; 
double newheight = heightInput; 
NSSize newSize; 
if(widthInput >= 72) 
{ 
    double ratio; 
    ratio = widthInput/heightInput; 
    newheight = 72/ratio; 
    newSize = NSMakeSize (72, newheight); 
} 
else 
    newSize = NSMakeSize(widthInput, newheight); 
NSImage *outputImage = [[[NSImage alloc] initWithSize:newSize] autorelease]; 

if(![outputImage isValid]) 
    return nil; 

[outputImage lockFocus]; 

[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; 


[pImage drawInRect:NSMakeRect(0, 0, newSize.width, newSize.height) 
      fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; 

[outputImage unlockFocus]; 
NSData *imageData = [outputImage TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0]; 

return [imageData mutableCopy]; 
} 

0

您是否正在創建一個大的視圖或圖像,您要在地址簿中繪製多個聯繫人?這聽起來像你想創建一個太大的圖像/視圖。

+0

我準備只是其中包含的接觸,包括已在地址簿聯繫人設定畫面中的所有信息細節50個觸點陣列。我使用base64字符串轉換此聯繫人信息。 – 2010-08-27 06:51:44

+0

Leopard上未生成異常,最近我還檢查了Snow Leopard。但是不要再次得到這個異常。它只在我們的一個客戶的電腦上生成。 – 2010-08-27 06:52:35

+0

使用調試器。瀏覽你的代碼,直到你觸發消息。發佈相關代碼。 – 2010-08-28 14:06:32