Xcode 5 hangs while archiving

433 views Asked by At

I recently converted my iOS project to ARC. Now when I try to archive my app, the process hangs when/after compiling the last source file. In Activity Monitor two clang processes are almost on 100% CPU and I can't even switch off Xcode. If I set the Code Optimization Level to None everything works fine (which of course isn't a final solution).

Any suggestions how to solve this?

1

There are 1 answers

0
Jochen On BEST ANSWER

It turned out it was a retain circle in an animation block in ARC. Using weakSelf did the trick.

__weak __typeof(self) weakSelf = self;
[UIView animateWithDuration:0.3f
                      delay:0.5f
                    options:UIViewAnimationOptionCurveEaseIn
                 animations:^{
                     __typeof(weakSelf) strongSelf = weakSelf;
                     [strongSelf doStuff];
                     // ...
                 }
                 completion:^(BOOL finished){
                     // ...
                 }];

I figured this out by archiving the project via command line in verbos mode. It got stuck on one view controller which contained the retain circle.