Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impact of using LLVM-GCC to resolve issues on 2nd generation device running iOS 4.2.1 [duplicate]

I have an app that uses touch events to draw on the screen. I use UITouch locationInView to return the CGPoint of the touch. The problem is that the x and y coordinates are always the same — BUT only on 2nd generation devices running iOS 4.2.1 AND only when my app is built in Release mode. This also only seems to be a problem when taking touches directly from a touchesMoved or touchesEnded event object, since my buttons respond to touches correctly.

Thanks to a post at http://getmoai.com/forums/new-users/ios-touch-sensor-y-co-ordinate-always-the-same-as-x/ I was able to fix the problem by using the LLVM-GCC compiler rather than the newer LLVM 3.0 compiler and by using optimization level 0.

What is interesting is that using the GCC compiler corrected the touch locations I received in touchesEnded while changing the optimization level to -O0 corrected the touch locations I received in touchesMoved. I cannot explain why this is, but for now I'm ecstatic my app is working on these devices.

My questions then are — What are the downsides to delivering my app to the store using the older compiler? (I understand the impact of the optimization level.) And is there any way to configure the project so that I use the older compiler and lower optimization level only for iOS 4.2.1 and/or 2nd gen devices?

like image 730
jenonen Avatar asked Nov 14 '22 13:11

jenonen


1 Answers

I am using this hack:

// not working (location.x == location.y)
CGPoint location = [touch locationInView:_myView];
//

// working!
static CGPoint location;
location = [touch locationInView:_myView];
//
like image 84
MATov Avatar answered Dec 05 '22 11:12

MATov