Xcode 4.5.1 gets stuck when archiving

I just updated my xcode to version 4.5.1.
Everything worked fine, but now that I am archiving the project, xcode is stuck / hung and never completes archiving.
In the status above, the text reads:

Compiling 10 out of 10 source files ...

After that, nothing happens. He just got stuck.
I can still compile and build the code (without archiving), and everything works fine in the simulator.

I reinstalled xcode. After that, the problem still occurs. Any suggestion will be assigned.

Additional Information:
I pointed the problem to a specific line of code:
CGRect tmpFrame3 = seeDetailsButton.frame;
I do not see any problems with this line ...
Why does this work fine when building and running in the simulator, but it doesnโ€™t work when archiving?

+3
source share
4 answers

I understood what was going on here.
Firstly, this does not apply to the archive process itself, but to assembly in Release mode.
The reason I had a problem during the archive is because then it is created in release mode.

About the problem itself:
There seems to be some Apple compiler error in xcode 4.5.1.
I am using the Apple LLVM 4.1 compiler. At compile time, it has different optimization levels.
In Debug, optimization is set to "No" and disabled. The release is set to "Fastest, Smallest [-O]." When I turn off optimization in the release mode (set to "No") - the problem does not occur.

Additional Information:
After digging in my code and trying to figure out what would cause the compiler error during optimization, I saw that I had the following:

 __weak ProfileButton *tmp = myButton; 

If ProfileButton is a regular button inherited from UIButton.
When I __weak everything works fine. Even when I set the compiler optimization to "Fastest, smallest [-Os]".

+6
source

I recently ran into the same problem: when compiling Xcode on the last file. Just like the problem above, setting the optimization level for release to None ([-O0] according to the debug mode) will archive successful execution.

However, for our code, a specific error was tied to a block that was capturing itself. Per Apple Recommendations :

"If you need to lock yourself in a block, for example, when defining a callback block, it is important to consider memory management consequences.

Blocks support strong links to any captured objects, including self, which means it's easy to end with a strong link loop ... "

Therefore, do not forget to check your code for this, if applicable, and follow Apple's best practices to fix a weak reference to self ( example in the documentation ).

0
source

In my case, I created a round subclass

It was like

 @interface BaseTableViewController : PaymentTableViewController 

and

 @interface PaymentTabelViewController : BaseTableViewController 

I did this to rename the last subclass, so now it looks like this:

 @interface TopTableViewController : PaymentTableViewController 

and

 @interface PaymentTableViewController : BaseTableViewController 
0
source

In my case, the problem occurred when one of the source files contained a very large array declaration like this:

 NSArray<NSArray<NSNumber *> *> *points = @[ @[@38.576732f, @-90.230682f, @1495320246], // 1 item ... @[@37.478034f, @-89.524851f, @1495336147] // 3000 item ]; 

There were about 3 thousand items. Dividing the source line into small ones does not help.

Fixed it by placing items in a CSV file and analyzing it at runtime.

Another approach can be broken down into smaller arrays and concatenations at runtime.

0
source

Source: https://habr.com/ru/post/1435593/


All Articles