简体   繁体   中英

How to run Xcode app outside of Xcode? MacOS Stand alone app doesn't run the same as app in Xcode Simulator

I am developing a macOS app in Xcode 10.1.1 under Mojave 10.14.5.

My app works when I run it in the Xcode debugger. However, when I drag the app from Xcode, and try to run it stand alone, it does not launch correctly.

QUESTION: Which settings in Xcode would cause the stand alone app to be compiled differently or run differently from the version running in Xcode?

More details:

My Swift coding skills are pretty good at this point, but I am still a beginner with Xcode Schemes, build settings, etc. So I may have randomly changed an important setting since my last attempt to run standalone, last November.

I have tried dragging the app from Xcode's File Navigation "Products" tab to the Applications folder. I have also tried running Products > Archive to copy the file to a folder, and drag that version to the Applications folder.

Both produce the same result: When the app is run, it only displays a blank window. It does not launch my initial View Controller. The "About" menu etc., work, so I don't think the app is hanging...

More details: 1) I successfully copied the app out of Xcode to run standalone in November, using High Sierra. This is my first attempt at extracting this app in Mojave.

2) I WAS able to drag a DIFFERENT (new) app out of Xcode in Mojave without issues last week.

3) The only non-default compile setting I know forces the Swift Language to Version 4.2, because this app uses SwiftSoup Cocoa Pods.

4) As I mentioned, the app runs just fine in Xcode.

Please let me know if you have any suggestions for how to review my environment, or how to resolve or debug this issue.

Updates: When I tried Products > Archive, I noticed my Archive Scheme was set to Release. I tried both "Release" and "Debug" schems for Archive. Same result.

This app is for my personal use only, so I am happy to run a "Debug" executable outside of Xcode, if that is easier than a "Release" version.

This is what I mean by "drag the app from Xcode's 'Products' section' 在此处输入图片说明

I asked a more detailed question on this topic, and got a better answer.

This problem is due to WkWebView that was added directly to a view controller in Interface Builder (IB). Others are reporting similar issues. Adding a WkWebview directly in IB worked for me in Xcode 9.4.1, but not in Xcode 10.2.1

My new question is here: Archived macOS app launches with blank window

The new question was marked as duplicate. A detailed discussion on Apple Developer Forun, including simple code is here: https://forums.developer.apple.com/thread/116047

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM