Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS precision differences between debug/release builds messing up views?

Tags:

ios

iphone

build

I have some code where I'm trying to modify the attributes of one CGRect, and set another CGRect with this new frame:

actView         = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray ] autorelease];
actView.hidesWhenStopped = NO;
[actView startAnimating];
frame           = actView.frame;
frame.origin.x  = mainLabel.frame.origin.x - frame.size.width - TBLCELLPADDING;
frame.origin.y  = mainLabel.frame.origin.y;
actView.tag     = TBLCELLACTTAG;
actView.frame   = frame;
[cell.contentView addSubview:actView];

This works fine in debug builds and release builds for newer iPhones. Running on a release build for a 3G iPhone however, creates some crazy results and messes up the views.

Expected Results (works with newer phones):

2012-01-01 14:41:43:449 myapp [691:775] Loading MainLabel: 122.000000 26.000000
2012-01-01 14:41:43:605 myapp[691:775] Loading Frame: 97.000000 26.000000
2012-01-01 14:41:43:713 myapp[691:775] Loading ActView: 97.000000 26.000000

Results for an iPhone 3G running 4.2 firmware with a Release Build (this happens on any firmware):

2012-01-01 14:43:39:516 myapp[706:775] Loading MainLabel: 122.000000 26.000000
2012-01-01 14:43:39:589 myapp[706:775] Loading Frame: 26.000000 26.000000
2012-01-01 14:43:39:792 myapp[706:775] Loading ActView: 26.000000 0.000000

This is screwing up views all across my app for this older iPhone.
Is there a way I should specifically be handling this in terms of code? Or should I modify something in the build settings for older iPhones?

like image 508
Shaun Budhram Avatar asked Jan 23 '26 12:01

Shaun Budhram


1 Answers

As the problem only exists on ARMV6 based devices and only when building optimized code, it possibly is founded in the faulty ARMV6 optimizing of llvm.

Add the following to your build settings as a user defined setting:

GCC_THUMB_SUPPORT = NO

This is how it should look like: enter image description here

What this does is, it entirely disabled the thumb instruction set build for your app. If this results into a properly functioning App, check if the App still performs fine on the ARMV7 devices as this setting may severely influence the performance.

Even though this appears to be a GCC specific setting, this still is respected by LLVM and saved my behind in some older projects that I needed to update.

like image 162
Till Avatar answered Jan 26 '26 02:01

Till