存档的macOS应用程序启动时出现空白窗口 [英] Archived macOS app launches with blank window

查看:189
本文介绍了存档的macOS应用程序启动时出现空白窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MacOS应用程序,它的ViewController可以重命名和调整应用程序窗口的大小,并具有几个按钮,还有一个WKWebView可以在启动时加载默认网页.

I have a macOS app with a ViewController that renames and resizes the app window, has several buttons, and a WKWebView that loads a default webpage on launch.

该项目本身是一个.xcworkspace文件,因为它包含用于HTML抓取的CocoaPod SwiftSoup.

The project itself is an .xcworkspace file, since it includes the CocoaPod SwiftSoup for HTML scraping.

该应用程序在模拟器中运行良好.启动时,它看起来像这样:

The app runs great in the simulator. When it launches, it looks like this:

我想在Xcode之外的Mac上运行此应用程序.我不打算将其发布到App Store,这只是供我个人使用.

I want to run this app on my Mac outside of Xcode. I am not planning on releasing it to the App Store, it is just for my personal use.

我使用产品>存档来存档项目,然后选择分发应用程序",然后选择复制应用程序"以使用存档的应用程序创建目录.这一切都很好.

I archive the project with Products > Archive, then select "Distribute App", then "Copy App" to create a directory with the archived app. This all works great.

启动应用程序时,我得到的是一个错误尺寸的空白无标题窗口,没有故事板中的按钮或WKWebView:

When I launch the app, I just get an incorrectly sized blank title-less window, without the buttons or WKWebView from my Storyboard:

该应用未挂起.我可以打开关于"菜单项等,因此我知道该应用程序正在运行.它似乎似乎并没有使用我的Storyboard来绘制UI.

The app isn't hanging. I can open the "About" menu item, etc., so I know the app is running. it just doesn't seem to be using my Storyboard to draw the UI.

什么会使存档的应用程序与模拟器中运行的应用程序不同?

What would cause an archived app to differ from the app running in the simulator?

有趣的是,我能够在11月在High Sierra下将同一应用程序存档,所以我猜问题可能与Cocoa Pods和/或Mojave有关.

The funny thing is that I WAS able to archive this same app back in November under High Sierra, so I'm guessing the issue is either Cocoa Pods and/or Mojave related.

我的调试使我怀疑与CocoaPods或Mojave相关

My debugging leads me to suspect either CocoaPods or Mojave related

我的调试: 1)在调试时,我从11月恢复了该项目的版本.存档还原的项目时,我得到的是相同的空白未运行应用程序.

My debug: 1) While debugging, I restored a version of the project from November. When I archive that restored project, I get the same blank non running app.

2)我可以归档另一个不使用Cocoa Pods的全新项目,所以我的猜测是这是CocoaPods和/或与Mojave相关的问题...

2) I AM able to archive another brand new project that doesn't use Cocoa Pods, so my guess is that this is either CocoaPods and/or Mojave related issue...

任何有关如何进行调试或帮助解决此问题的建议将不胜感激!

Any suggestions on how to proceed debugging, or help resolving this would be greatly appreciated!

我正在Mojave 10.14.5下使用Xcode 10.2.1.

I am using Xcode 10.2.1 under Mojave 10.14.5.

推荐答案

此问题是由WKWebView引起的. 因此,您需要从IB中删除WKWebView,然后使用代码创建它并将其添加到视图中.

This problem is caused by WKWebView. So, you need remove WKWebView from IB and then create it with code and add it to the view.

参考:
https://forums.developer.apple.com/thread/116047
http://www.openradar.me/23699297

REFER:
https://forums.developer.apple.com/thread/116047
http://www.openradar.me/23699297

这篇关于存档的macOS应用程序启动时出现空白窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆