그래픽 컨텍스트에 png를 렌더링하려고하는 일부 코드가 있습니다. 이 코드는 모든 시뮬레이터에서 잘 작동하며 iPad Air에서도 잘 작동합니다.drawAtPoint에서 충돌, 코드가 iPad Air, iPad 시뮬레이터에서 작동 함 iPad 1 및 iPad mini에서 충돌 발생
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];
다음은
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
drawAtPoint를 호출하면 충돌이 발생합니다 (별도의 스레드에서). 코드를 단계별로 실행할 때 계산 된 모든 값은 xCode 시뮬레이터에서 실행될 때와 같으며 UIImage는 null이 아닙니다. 이는 제한된 프로세싱 성능 또는 iPad의 제한된 메모리로 인한 것입니까? 고칠 방법에 관한 어떤 생각?
감사합니다.
- 데이브
이미지의 크기는 어느 정도입니까? –
디버거는 무엇을 말합니까? – Larme
이미지는 3680x3464, 파일 크기는 약 0.5MB입니다. 그것은 엄청나게 거대한 것처럼 보이지 않지만, 그것이 도움이되는지보기 위해 해상도를 줄이려고 노력할 것입니다. 메모리와 관련이 있다면 시뮬레이터가 실제 장치의 메모리 한계를 시뮬 레이팅 할 수 없다는 것은 불행한 일입니다.이 내용은 시뮬레이터에서 디버그하는 것이 훨씬 쉽습니다! – Dave