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

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

问题描述

我有一个带有 ViewController 的 macOS 应用程序,它可以重命名和调整应用程序窗口的大小,有几个按钮,还有一个 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

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

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