簡體   English   中英

在drawAtPoint期間崩潰,代碼在iPad Air,iPad模擬器上工作,在iPad 1和iPad mini上崩潰

[英]Crash during drawAtPoint, code works on iPad Air, iPad simulator, crashes on iPad 1 and iPad mini

我有一些代碼試圖將png渲染到圖形上下文。 該代碼在所有模擬器中均能正常運行,在iPad Air上也能正常運行。 但是,當我在iPad mini或iPad上運行它時,在連接到xCode時運行它時會看到以下崩潰:

ImageIO`ImageIO_ABGR_TO_ARGB_8Bit: 0x36f27c70: push {r4, r5, r6, r7, lr} 0x36f27c72: add r7, sp, #0xc 0x36f27c74: push.w {r8, r10, r11} 0x36f27c78: ldr r1, [r0] 0x36f27c7a: ldr r2, [r0, #0xc] 0x36f27c7c: cmp.w r2, r1, lsl #2 0x36f27c80: blo 0x36f27d06 ; ImageIO_ABGR_TO_ARGB_8Bit + 150 0x36f27c82: ldr r3, [r0, #0x18] 0x36f27c84: lsls r2, r1, #0x2 0x36f27c86: cmp r3, r2 0x36f27c88: blo 0x36f27d06 ; ImageIO_ABGR_TO_ARGB_8Bit + 150 0x36f27c8a: ldr r2, [r0, #0x4] 0x36f27c8c: cmp r2, #0x0 0x36f27c8e: beq 0x36f27d06 ; ImageIO_ABGR_TO_ARGB_8Bit + 150 0x36f27c90: bic lr, r1, #0x7 0x36f27c94: ldr r3, [r0, #0x8] 0x36f27c96: ldr.w r12, [r0, #20] 0x36f27c9a: sub.w r4, r1, lr 0x36f27c9e: asrs r5, r1, #0x3 0x36f27ca0: mov r6, r12 0x36f27ca2: mov r8, r3 0x36f27ca4: cbz r5, 0x36f27cbe ; ImageIO_ABGR_TO_ARGB_8Bit + 78 0x36f27ca6: mov r8, r3 0x36f27ca8: mov r9, r5 0x36f27caa: mov r6, r12 0x36f27cac: vld4.8 {d0, d1, d2, d3}, [r8]! 0x36f27cb0: vswp d0, d2 0x36f27cb4: vst4.8 {d0, d1, d2, d3}, [r6]! <<--- crash on this line 0x36f27cb8: subs.w r9, r9, #0x1

這是生成崩潰的代碼:

NSString* imgFile = @"ShotZones.png";
UIImage* img = [UIImage imageNamed:imgFile];
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
float scaleShotZoneFeetToPixels = img.size.width / shotZoneCourtSizeInFeet.x;
CGRect courtRect = {{0, 0}, img.size};
CGFloat scaleFactor = screenWidth / courtRect.size.width;
UIGraphicsBeginImageContext(img.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, scaleFactor, scaleFactor);
[img drawAtPoint: courtRect.origin];

它在調用drawAtPoint時崩潰(在單獨的線程中)。 單步執行代碼時,所有計算值都與在xCode模擬器中運行時相同,UIImage不為null,等等。這是由於處理能力有限還是iPad上的內存有限? 關於如何解決有什么想法?

謝謝!

  • 戴夫

好的,我知道了。 這是圖像的分辨率。 我將其降低了4倍,現在可以使用了。 我認為設備內存不足。 如果有人知道如何配置模擬器以模擬iPad 1或mini的存儲容量,我將不勝感激。 我希望能夠在模擬器中進行盡可能多的調試/測試!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM