Search code examples
xcodemacoswkwebviewarchive

Archived macOS app launches with blank window


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.

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:

enter image description here

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.

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

enter image description here

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?

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.

My debugging leads me to suspect either CocoaPods or Mojave related

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) 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!

I am using Xcode 10.2.1 under Mojave 10.14.5.


Solution

  • 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.

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