iphone - 从 App Store 下载时,为什么我的应用程序在 iPhone 3G 上绘制不正确?

标签 iphone ios xcode cocoa-touch app-store

我有一个在设备上的 Debug模式下运行良好的应用程序。我将应用程序发送到 App Store,它运行良好,但 iPhone 3G 除外。

我的测试(调试)设备是 iPhone 3G,它在调试时工作得很好,但是当我下载该应用程序并通过 App Store 安装它时,它也不能在我的 iPhone 上工作。

我在代码中有一些 NSLogs 并认为这可能是问题所在,但即使在删除 NSLog 之后,iPhone 3G 上也会发生同样的事情。

问题是我正在使用以下代码:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    mouseSwiped = YES;

    UITouch *touch = [touches anyObject];   
    CGPoint currentPoint = [touch locationInView:self.view];
    currentPoint.y -= 20;


    UIGraphicsBeginImageContext(self.view.frame.size);
    [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
    CGContextBeginPath(UIGraphicsGetCurrentContext());
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
    CGContextStrokePath(UIGraphicsGetCurrentContext());
    drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    lastPoint = currentPoint;

}

在 iPhone 3G 上,这并不正确。它只是制作水平线。这在其他设备上运行良好。

这里可能出了什么问题?

最佳答案

Xcode 4.2 中的 LLVM 编译器存在一个已知错误,在 ARMv6 架构上使用 CGPoints 等时会导致错误结果。这在 this thread on the Apple Developer Forums 中有详细说明. ARMv6 用于 iPhone 3G S 之前的设备(例如您的 iPhone 3G),这就是您会在那里看到它的原因。

该错误与为您的应用程序的 ARMv6 版本生成不正确的 Thumb 代码有关。我在我的回答 here 中描述了如何选择性地为旧架构禁用 Thumb(同时保留未受影响的 ARMv7 版本的性能) .

有人说 Xcode 4.2.1 有一个固定版本的 LLVM 可以解决这个问题,但我无法确认。在 this Apple Developer Forum thread 结尾处阅读 gparker 的评论查看已修复此问题的位置。

关于iphone - 从 App Store 下载时,为什么我的应用程序在 iPhone 3G 上绘制不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8591540/

相关文章:

xcode - 手动编译 Metal 着色器

iphone - 删除 SQLITE 行 UITABLEVIEW

iphone - 我想问如何将十六进制NSString转换为long值

android - 最安全的移动数据库策略

iphone - componentsSeparatedByString 返回错误的结果

iphone - 为什么 XCode 存档与 XCode 在 iPhone 上构建/运行不同

iphone - 将最后一个单元格添加到 UItableview

ios - 如何在用户点击注销按钮时弹出所有 View 并返回登录 View

ios - Swift:如何声明一个空的命名元组数组?

ios - 如何检查 id 是否指向 CGRect?