1

在将 Xcode 升级到 6.3 之后,故事板文件之前是使用 Xcode6.0 创建的。编译错误会以晦涩难懂的错误消息跳出。我花了几个小时搜索,但仍然没有弄清楚有问题的项目在我的故事板文件中到底是什么/在哪里。

非常感谢您的时间/建议等。

以下是完整的错误消息:

    nwi_state: registration failed (1000000)
    2015-04-11 09:01:43.783 Interface Builder Cocoa Touch Tool[11220:234260] ***storageTaskManagerExistsWithIdentifier:withIdentifier failed: Error Domain=NSCocoaErrorDomain Code=4099 "The operation couldn’t be completed. (Cocoa error 4099.)" (The connection to service named com.apple.nsurlstorage-cache was invalidated.) UserInfo=0x7ffb92e2b7b0 {NSDebugDescription=The connection to service named com.apple.nsurlstorage-cache was invalidated.};
    {NSDebugDescription = "The connection to service named com.apple.nsurlstorage-cache was invalidated.";}
    nwi_state: registration failed (1000000)
    2015-04-11 09:01:55.387 Interface Builder Cocoa Touch Tool[11225:234925] ***storageTaskManagerExistsWithIdentifier:withIdentifier failed: Error Domain=NSCocoaErrorDomain Code=4099 "The operation couldn’t be completed. (Cocoa error 4099.)" (The connection to service named com.apple.nsurlstorage-cache was invalidated.) UserInfo=0x7fac79702450 {NSDebugDescription=The connection to service named com.apple.nsurlstorage-cache was invalidated.}; {
NSDebugDescription = "The connection to service named com.apple.nsurlstorage-cache was invalidated.";}
    2015-04-11 09:02:06.649 ibtoold[11212:234105] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-7531/InterfaceBuilderKit/Utilities/IBAbstractMessageChannelInterfaceBuilderToolProxy.m:38
    Details:  Failed to compile nib consisting of IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBLayoutConstraint, IBProxyObject, IBProxyObject, IBUIImageView, IBUILabel, IBUILabel, IBUITableViewCell, IBUITableViewCellContentView, and IBUITextView.

    Encountered an error communicating with Interface Builder Cocoa Touch Tool. If you choose to file a crash report or Radar for this issue, please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" and include their content in your crash report.

    Exception name: NSInvalidArgumentException
    Exception reason: *** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs
    Exception backtrace:
      0. CoreFoundation           0x000000010b92fc4d __exceptionPreprocess
      1. libobjc.A.dylib          0x000000010a6cebb7 objc_exception_throw
      2. CoreFoundation           0x000000010b92fb9d +
      3. Foundation               0x000000010a3f7233 VerifyConstraintArguments
      4. Foundation               0x000000010a260a5a +
      5. IBAutolayoutFoundation   0x0000000109ddaebc -
      6. IBCocoaTouchToolFoundation 0x00000001081fb977 -
      7. IBCocoaTouchToolFoundation 0x000000010821713b -
      8. IBCocoaTouchToolFoundation 0x00000001081f18b8 -
      9. IBFoundation             0x0000000109efe549 __80-[IBMessageReceiveChannel deliverMessage:toTarget:withArguments:context:result:]_block_invoke
     10. IBFoundation             0x0000000109efe2a6 -
     11. IBFoundation             0x0000000109efdf90 __88-[IBMessageReceiveChannel runBlockingReceiveLoopNotifyingQueue:notifyingTarget:context:]_block_invoke
     12. libdispatch.dylib        0x000000010eeec964 _dispatch_client_callout
     13. libdispatch.dylib        0x000000010eed9818 _dispatch_barrier_sync_f_slow_invoke
     14. libdispatch.dylib        0x000000010eeec964 _dispatch_client_callout
     15. libdispatch.dylib        0x000000010eed7a59 _dispatch_main_queue_callback_4CF
     16. CoreFoundation           0x000000010b8971f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
     17. CoreFoundation           0x000000010b858dcb __CFRunLoopRun
     18. CoreFoundation           0x000000010b858366 CFRunLoopRunSpecific
     19. Foundation               0x000000010a284f92 -
     20. IBFoundation             0x0000000109edcc20 -
     21. IBFoundation             0x0000000109edcdaf -
     22. IBFoundation             0x0000000109edd072 +
     23. ???                      0x0000000108177be7 ???
     24. libdyld.dylib            0x000000010ef1c145 start
    Exception info:{
    }

    Function: __IBAssertMarshallingFailureWithUniqueBacktrace_block_invoke
    Thread:   <NSThread: 0x7fc88b104020>{number = 1, name = main}
    Hints: None
    Backtrace:
      0  0x0000000104b3f4a1 -[DVTAssertionHandler handleFailureInFunction:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
      1  0x0000000104b3ec3b _DVTAssertionHandler (in DVTFoundation)
      2  0x0000000104b3ee9e _DVTAssertionFailureHandler (in DVTFoundation)
      3  0x0000000105a685e8 __IBAssertMarshallingFailureWithUniqueBacktrace_block_invoke (in IDEInterfaceBuilderKit)
      4  0x0000000105a68407 IBAssertMarshallingFailureWithUniqueBacktrace (in IDEInterfaceBuilderKit)
      5  0x0000000105a6825e IBAssertMarshallingFailure (in IDEInterfaceBuilderKit)
      6  0x000000010cd2f89a (in IDEInterfaceBuilderCocoaTouchIntegration)
      7  0x000000010cd303c9 (in IDEInterfaceBuilderCocoaTouchIntegration)
      8  0x0000000105a0757c -[IBDocumentCompiler invokeWhileUsingSourceAsIntermediateDocument:] (in IDEInterfaceBuilderKit)
      9  0x0000000105a0788d -[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:] (in IDEInterfaceBuilderKit)
     10  0x000000010cd2fc97 (in IDEInterfaceBuilderCocoaTouchIntegration)
     11  0x000000010cd1e0e2 (in IDEInterfaceBuilderCocoaTouchIntegration)
     12  0x0000000105c19cd4 -[IBStoryboardSceneCompilationGroup compilationResultsForCompilationUnits:options:returningErrors:] (in IDEInterfaceBuilderKit)
     13  0x0000000105c0aa9a -[IBStoryboardDocumentCompiler compileUnitsFromCompilationGroups:filter:options:errors:] (in IDEInterfaceBuilderKit)
     14  0x0000000105c0bd73 __78-[IBStoryboardDocumentCompiler compileContentsOfStoryboardWithOptions:errors:]_block_invoke (in IDEInterfaceBuilderKit)
     15  0x0000000105ae5f46 IBWithAutoInvalidationPool (in IDEInterfaceBuilderKit)
     16  0x0000000105c0bb15 -[IBStoryboardDocumentCompiler compileContentsOfStoryboardWithOptions:errors:] (in IDEInterfaceBuilderKit)
     17  0x0000000105c0c116 -[IBStoryboardDocumentCompiler internalCompileWithOptions:error:] (in IDEInterfaceBuilderKit)
     18  0x000000010cd1e2f4 (in IDEInterfaceBuilderCocoaTouchIntegration)
     19  0x0000000105c0ca56 __57-[IBStoryboardDocumentCompiler compileWithOptions:error:]_block_invoke (in IDEInterfaceBuilderKit)
     20  0x0000000105a07699 -[IBDocumentCompiler invokeWithIntermediateDocument:] (in IDEInterfaceBuilderKit)
     21  0x0000000105a0783d -[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:] (in IDEInterfaceBuilderKit)
     22  0x0000000105c0c6fc -[IBStoryboardDocumentCompiler compileWithOptions:error:] (in IDEInterfaceBuilderKit)
     23  0x0000000105a07a27 +[IBDocumentCompiler compileContentsOfDocument:options:error:] (in IDEInterfaceBuilderKit)
     24  0x00000001059c2640 __47-[IBDocument compiledPackageWithOptions:error:]_block_invoke (in IDEInterfaceBuilderKit)
     25  0x00000001059fafd5 -[IBDocumentAutolayoutManager assertIfArbitrationIsScheduledDuring:] (in IDEInterfaceBuilderKit)
     26  0x00000001059c2597 -[IBDocument compiledPackageWithOptions:error:] (in IDEInterfaceBuilderKit)
     27  0x0000000104947f0a (in ibtoold)
     28  0x0000000104944b40 (in ibtoold)
     29  0x0000000104947370 (in ibtoold)
     30  0x000000010494d233 (in ibtoold)
     31  0x000000010494d7b0 (in ibtoold)
     32  0x000000010494d683 (in ibtoold)
     33  0x000000010493c60a (in ibtoold)
     34  0x000000010494ce2c (in ibtoold)
     35  0x000000010494c074 (in ibtoold)
     36  0x00007fff8a78b5c9 start (in libdyld.dylib)
     37  0x0000000000000002
    Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool failed with exit code 
4

3 回答 3

0

如果您尝试向不在视图层次结构中的视图添加约束,就会发生这种情况。自动布局限制。

我继续使用 Xcode 6.3 并执行了以下操作:

我找出了哪个以编程方式创建的约束导致了问题(通过在调试中运行代码并查看何时发生崩溃)。然后我调试到这一点,并在添加约束时检查约束中的两个视图都不是空的。其中之一是。我解决了这个问题,错误消失了。

于 2015-04-29T11:44:51.677 回答
0

最后用一种可行的(虽然不是有效的)方法解决了这个问题:

通过从情节提要中删除其他视图场景,以“二分搜索”方式缩小范围以定位有问题的视图场景。

在确定有问题的视图后,我重新设置了视图及其约束。然后,构建成功。

在这里分享它,因为它可能对其他人有用。

于 2015-04-12T12:19:49.983 回答
0

这就是我解决问题的方法:我将情节提要文件复制到我的 Windows 机器上,并使用 Linq to XML 编写了一个小 C# 程序来查找虚假约束,该约束具有“firstItem”属性但缺少“secondItem”属性。基本上只有一行:

        var nosecondCons = xdoc.Descendants("constraint").Where(p => p.Attribute("secondItem") == null && p.Attribute("firstItem") != null);
于 2015-07-16T07:42:29.337 回答