MacOS app does not run on the Xcode simulator

非 Y 不嫁゛ 提交于 2019-11-27 11:51:01

问题


I've installed Xcode 4.2.1 on Mac OS X Lion.

When I create a new (Mac OS X Cocoa) project and I click "Run", Xcode says build succeeded, but doesn't run the project. No errors, but no application either.

When I do exactly the same thing on another Mac (but with OS X Snow Leopard and Xcode 4.0.1 installed), the created app starts bouncing in the dock and shows an empty window, like I would expect.

When I look in the Console, there seems to be nothing strange going on. I tried reinstalling Xcode, deleting everything related to Xcode, but still no luck.

Anyone got an idea what could be the problem?

(I tried running an existing project which used to work, but that didn't show anything either)

Thanks.


回答1:


I had a similar problem with Xcode 4.5.2.

To fix it I had to go to the menu Product > Edit Scheme... > Select "Run " (in the sidebar) > Info (tab). In here is a drop down box labeled Executable, select it and choose your app that you wish to launch when the Run button is clicked.




回答2:


I messed up my settings and had this same issue - builds the app but doesn't launch (either in the simulator or the device).

The answer Product > Edit Scheme got me half way there - then choose Run {your app} on the left. There is a launch Automatically radio button to check:




回答3:


I had the same issue in late 2017 with Xcode 9.2.

I had to uncheck 'Debug Executable' and then my app was able to both run and stop.

You can open the settings by clicking Product -> Scheme -> Edit Scheme...




回答4:


Simple

Select the desired active scheme and device/simulator from the toolbar (next to the "play" and "stop" buttons).

The scheme selection should look something like below where the name is that of the appropriate target.




回答5:


Check if your project has entitlements enabled. Sandbox or iCloud or both.

If you have that enabled and you dont have an appropriate cert from the Dev portal your app will build but not launch.

Switch the entitlements off if you are not actively developing functionality around them.

The Console app will show this up as a permissions failure. But oddly not the Xcode debug console.




回答6:


I know this is a well accepted answered question, however for those who are building / running on a physical device

SOLUTION: Hard-restart the device, then clean the project in Xcode ⇧+⌘+K.

I think the bundle gets confused causing Xcode to "think" it already ran the project, therefore showing "Finished" instead of launching whichever application you selected to run.




回答7:


Try removing the dev tools by running

sudo Developer/Library/uninstall-devtools --mode=all

in Terminal. This will properly remove all components of the dev tools, including the command-line components.

You can then try a re-install.




回答8:


I had similar problems. I found that the problem was in ~/.gdbinit file. And a second time - at the window initialization function loadWithNibName/initWithWindow (wrong name nib file or frame properties). Also check the file Info.plist in your project (parameters "Main nib file base name" and "Principal class").




回答9:


Do you have the correct project selected to run?

Click on the project name next to the stop button (top left). Are there multiple projects listed? Do you have the correct one selected?




回答10:


Xcode 10.2

Steps:

  1. Product -> Scheme -> Edit Scheme
  2. Run
  3. Info
  4. Executable -> Yourproject.app
  5. Run whole project again

Screenshot:



来源:https://stackoverflow.com/questions/8244953/macos-app-does-not-run-on-the-xcode-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!