Xcode 9 Main.storyboard 构建应用程序时出错 "Internal error. Please file a bug at bugreport.apple.com and attach "

Xcode 9 Main.storyboard error when building app "Internal error. Please file a bug at bugreport.apple.com and attach "

我在去年 Xcode 8 中构建的 Xcode 项目上遇到了这个错误,现在我试图在 Xcode 9 GM 中打开它。

编辑仔细检查,我注意到它没有使用 GM,我使用的是 Xcode 9.1 beta 2。下面的解决方案有效!

错误:

/Users/XXXX/Documents/App Development/Final Apps/XXXX/Base.lproj/Main.storyboard: Internal error. Please file a bug at bugreport.apple.com and attach "/var/folders/ln/n28_nbyn2cg9_5dfqfsj8_7w0000gn/T/IB-agent-diagnostics_2017-10-04_21-24-39_279000".

我试过其他类似帖子的建议:

  1. 使用 Command + Shift + k 清理项目
  2. 使用 Command + Option + Shift + l 删除生成派生数据文件夹
  3. 退出 Xcode 并重新打开它
  4. 也重启了Mac

如果我转到错误消息指向的文件夹,我看到的内容为:

CoreSimulatorLogs   Document.storyboard Log.txt         system.log

在 Log.txt 中,我看到了这个:

Failed to compile nib consisting of IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBProxyObject, IBUIBarButtonItem, IBUIBarButtonItem, IBUIBarButtonItem, IBUIBarButtonItem, IBUIBarButtonItem, IBUIBarButtonItem, IBUICollectionViewController, IBUINavigationBar, IBUINavigationBar, IBUINavigationBar, IBUINavigationBar, IBUINavigationBar, IBUINavigationController, IBUINavigationController, IBUINavigationController, IBUINavigationController, IBUINavigationController, IBUINavigationItem, IBUINavigationItem, IBUINavigationItem, IBUINavigationItem, IBUINavigationItem, IBUIStoryboardEmbedSegueTemplate, IBUIStoryboardEmbedSegueTemplate, IBUIStoryboardShowSegueTemplate, IBUITabBar, IBUITabBarController, IBUITabBarItem, IBUITabBarItem, IBUITabBarItem, IBUITabBarItem, IBUITabBarItem, IBUITableViewController, IBUIViewController, IBUIViewController, and IBUIViewController.

Exception name: NSInvalidArgumentException
Exception reason: System-provided UIImage instances cannot be encoded in NIBs - raised for instance '<UIImage: 0x7f945db51a90>, {18, 20}'
Exception backtrace:
  0. CoreFoundation           0x000000010800d023 __exceptionPreprocess
  1. libobjc.A.dylib          0x0000000106de3f41 objc_exception_throw
  2. IBCocoaTouchToolFoundation 0x0000000103071a8a -[IBCocoaTouchToolNibFactory nibCoder:willEncodeObject:]
  3. IBCocoaTouchToolFoundation 0x0000000103071b77 -[IBCocoaTouchToolNibFactory nibCoder:willEncodeObject:forObject:forKey:]
  4. UIKit                    0x00000001038111f5 -[UINibEncoder replacementObjectForObject:forKey:]
  5. UIKit                    0x0000000103811d4d -[UINibEncoder encodeObject:forKey:]
  6. UIKit                    0x0000000103a4a6de -[UITabBarItem encodeWithCoder:]
  7. UIKit                    0x0000000103811ea0 -[UINibEncoder encodeObject:forKey:]
  8. IBCocoaTouchToolFoundation 0x000000010305ed41 -[UIViewControllerTemplate encodeWithCoder:]
  9. IBCocoaTouchToolFoundation 0x0000000103055018 -[UINavigationControllerTemplate encodeWithCoder:]
 10. UIKit                    0x0000000103811ea0 -[UINibEncoder encodeObject:forKey:]
 11. UIKit                    0x0000000103811354 -[UINibEncoder serializeArray:]
 12. UIKit                    0x0000000103811ea0 -[UINibEncoder encodeObject:forKey:]
 13. IBCocoaTouchToolFoundation 0x000000010305ef3c -[UIViewControllerTemplate encodeWithCoder:]
 14. IBCocoaTouchToolFoundation 0x00000001030704d9 -[UITabBarControllerTemplate encodeWithCoder:]
 15. IBCocoaTouchToolFoundation 0x0000000103071e57 -[UIClassSwapper(IBHooksFor6767205) designTimeEncodeWithCoder:]
 16. UIKit                    0x0000000103811ea0 -[UINibEncoder encodeObject:forKey:]
 17. UIKit                    0x0000000103811354 -[UINibEncoder serializeArray:]
 18. UIKit                    0x0000000103811ea0 -[UINibEncoder encodeObject:forKey:]
 19. IBCocoaTouchToolFoundation 0x000000010307166c -[IBCocoaTouchToolNibFactory encodeNibContentWithCoder:]
 20. IBCocoaTouchToolFoundation 0x0000000103071801 -[IBCocoaTouchToolNibFactory nibDataWithMinimumCompatibility:]
 21. IBCocoaTouchToolFoundation 0x0000000103071d43 +[IBCocoaTouchToolNibFactory nibDataFromObjects:customClasses:topLevelObjects:traitStorageLists:accessibilityConfigurations:connections:keyValuePairs:visibleWindows:minimumCompatibility:]
 22. IBCocoaTouchToolFoundation 0x00000001030379d5 -[IBCocoaTouchTool compileNibForRequest:minimumCompatibility:layoutInfo:imagesToImageNames:]
 23. IBFoundation             0x000000010640009b __80-[IBMessageReceiveChannel deliverMessage:toTarget:withArguments:context:result:]_block_invoke
 24. IBFoundation             0x00000001063ffe98 -[IBMessageReceiveChannel deliverMessage:toTarget:withArguments:context:result:]
 25. IBFoundation             0x00000001063ff80a __88-[IBMessageReceiveChannel runBlockingReceiveLoopNotifyingQueue:notifyingTarget:context:]_block_invoke
 26. libdispatch.dylib        0x000000010cf352b5 _dispatch_client_callout
 27. libdispatch.dylib        0x000000010cf40999 _dispatch_sync_thread_bound_invoke
 28. libdispatch.dylib        0x000000010cf352b5 _dispatch_client_callout
 29. libdispatch.dylib        0x000000010cf3f496 _dispatch_main_queue_callback_4CF
 30. CoreFoundation           0x0000000107fcfd79 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
 31. CoreFoundation           0x0000000107f94422 __CFRunLoopRun
 32. CoreFoundation           0x0000000107f93849 CFRunLoopRunSpecific
 33. Foundation               0x00000001067dfe5e -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
 34. IBFoundation             0x00000001063c1cf5 -[IBAbstractPlatformTool startServingReceiveChannel:]
 35. IBFoundation             0x00000001063c1fb0 -[IBAbstractPlatformTool startServingWriteDescriptor:readDescriptor:]
 36. IBFoundation             0x00000001063c2ac9 +[IBAbstractPlatformTool main]
 37. ???                      0x0000000102f9aba7 ???
 38. libdyld.dylib            0x000000010cfa9d81 start
Exception info:{
}

我不知道如何进行。有什么建议吗?

这个错误是什么意思?

System-provided UIImage instances cannot be encoded in NIBs - raised for instance '<UIImage: 0x7f945db51a90>, {18, 20}'

清除 DerivedData 文件夹(在 ~/Library/Developer/Xcode/DerivedData 中)解决了我的问题。

来自 Xcode 9.1 beta 2 发行说明:

Interface Builder

A UITabBarItem configured as a system item in a storyboard or xib causes a build failure. (34197132)

Workaround: Configure as a custom item in Interface Builder, then reset the tab bar item to the desired system item in the awakeFromNib method of the view controller.

我遇到了和你一样的问题,这似乎是原因,因为日志指向我的一个 UITabBarItems。

编辑:我可以确认它有效。将所有系统 TabBarItems 更改为自定义,它将编译! EDIT2:你确定你没有使用 9.1 beta 吗?因为我在今天之前从未遇到过这个问题,当我测试 Xcode 9.1 beta 2(之前使用 Xcode 9 之后)。

这有点违反直觉,但完全重启才有所帮助。没有清理、删除派生数据或新故事板的帮助