Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.5.1 get stuck when archiving

I just upgraded my xcode to version 4.5.1.
Everything worked fine before but now, when I Archive the project, xcode get stuck/hanging and never finishes the archiving.
In the status on top, the text says:

Compiling 10 of 10 source files...

Nothing happens after that. It is just stuck.
I can still compile and build the code (without archiving) and everything runs just fine in the simulator.

I have reinstalled xcode. The issue still happens after that.
Any suggestion will be appriciated.

More info:
I've pinpointed the problem to a specific line of code:
CGRect tmpFrame3 = seeDetailsButton.frame;
I don't see any problem with this line...
Why would it work fine when building and running in the simulator but fail when archiving???

like image 216
Code Monkey Avatar asked Aug 15 '26 07:08

Code Monkey


1 Answers

I figured out what is going on here.
First, it is not related to the archive process itself but to the build in Release mode.
The reason that I had the problem during archive is because then it builds in release mode.

About the issue itself:
It seems that there is some sort of an Apple compiler bug in xcode 4.5.1.
I'm using the Apple LLVM compiler 4.1. During compilation it has different optimization levels.
In Debug - the optimization is set to 'None' and is off. In release it is set to 'Fastest, Smallest [-Os]'. When I turn off the optimization in release mode (set it to 'None') - the issue does not happen.

More info:
After digging in my code, and trying to figure out what would cause a compiler bug during optimization, I saw that I had the following:

__weak ProfileButton *tmp = myButton;

Where ProfileButton is just a regular button inherits from UIButton.
When I remove the __weak everything works just fine. Even when I set the compiler optimization to 'Fastest, Smallest [-Os]'.

like image 163
Code Monkey Avatar answered Aug 17 '26 22:08

Code Monkey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!