3

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???

4

4 回答 4

6

我弄清楚这里发生了什么。
首先,它与归档过程本身无关,而与Release模式下的构建有关。
我在存档期间遇到问题的原因是因为它是在发布模式下构建的。

关于问题本身: xcode 4.5.1 中
似乎存在某种Apple 编译器错误
我正在使用 Apple LLVM 编译器 4.1。在编译期间,它具有不同的优化级别。
在调试中 - 优化设置为“无”并关闭。在发行版中,它设置为“最快、最小 [-Os]”。当我在发布模式下关闭优化(将其设置为“无”)时 - 问题不会发生。

更多信息:
在挖掘了我的代码并试图找出在优化过程中会导致编译器错误的原因之后,我发现我有以下内容:

__weak ProfileButton *tmp = myButton;

其中 ProfileButton 只是一个继承自 UIButton 的常规按钮。
当我删除__weak一切工作正常。即使我将编译器优化设置为“最快、最小 [-Os]”。

于 2012-10-20T12:26:05.063 回答
0

最近遇到了同样的问题,Xcode 在编译期间挂在最终文件上。以与上述问题相同的方式,将发布的优化级别设置为无([-O0] 以匹配调试模式)将允许存档成功运行。

然而,对于我们的代码,特定的错误与一个正在捕获自身的块相关联。根据Apple 的指导方针

“如果你需要在一个块中捕获自我,例如在定义一个回调块时,考虑内存管理的影响是很重要的。

块保持对任何捕获对象的强引用,包括自身,这意味着很容易以强引用循环结束......”

因此,如果适用,请务必检查您的代码,并遵循 Apple 的最佳实践来捕获对 self 的弱引用(文档中的示例)。

于 2013-09-25T08:11:32.513 回答
0

就我而言,我创建了一个循环子类

这就像是

@interface BaseTableViewController : PaymentTableViewController 

@interface PaymentTabelViewController : BaseTableViewController

我所做的是重新命名最后一个子类,所以它现在看起来像这样:

@interface TopTableViewController : PaymentTableViewController 

@interface PaymentTableViewController : BaseTableViewController 
于 2014-03-15T22:44:11.450 回答
0

在我的情况下,当一个源文件包含一个非常大的数组的声明时,问题就出现了,如下所示:

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

大约有 3k 个项目。将源代码行拆分成小行并没有帮助。

通过将项目放在 CSV 文件中并在运行时对其进行解析来修复它。

另一种方法可能是拆分成更小的数组并在运行时连接。

于 2017-08-01T19:34:38.090 回答