Xcode 4.5 doesn't run / load app on simulators

2020-07-15 06:46发布

I'm running Xcode 4.5 on OS X Lion 10.7.5 on a Mid 2007 Mac Mini. I've run into this problem before where the simulators as well as actual devices don't run the app when I build. I'm writing a couple of different applications using Phonegap 2.1, HTML, JS, Jquery Mobile. I've reinstalled Xcode 2-3x after following the instructions from OSX Daily and SO How to fully remove Xcode 4. This worked for a while, but then my 300gb SSD drive died & I had to reinstall the OEM 120 GB hard drive & reinstall Xcode & Phonegap (both had revved versions since the drive had been uninstalled). Now I'm unable to get Xcode to start the simulators or download to my iPhone 4 again. I completely uninstalled Xcode again yesterday & reinstalled. The first time I tried to build, it took a long time downloading the 5.1 simulators (* see edit below), but finally "finished", but still didn't run them. Tried downloading to my phone, again nothing.

Since this is the third or fourth time that this has happened, I'm wondering what I'm doing wrong. Obviously I'm missing something because I don't see this problem being screamed about on the various support forums like here, Google, or Apple, only bits & pieces here and there.

As a test, I created a bare bones PhoneGap app that has nothing in it but whatever PG creates, and it doesn't run the simulators or download to my phone. This same method used to work just to test the system, but no longer. It builds fine, and darkens the square "running" button for a few seconds, and then the button lightens again like you've stopped the app, and that's it. No error messages, no build faults, nothing.

Intel is replacing my SSD drive, so I'm going to have to go through this all over again when it gets here, unless I can get a working copy running on the hard drive, then clone it with Carbon Copy Cloner so I can just copy that onto the new drive.

Any help would be greatly appreciated, I'd really like to not have to deal with this on an ongoing basis.

*Edit: I originally deleted this question because I thought I'd done something stupid, I realized I'd downloaded the documentation for the simulators, but not the actual simulators. I've since downloaded the 5.1 simulators and I'm still experiencing the same problems.

6条回答
够拽才男人
2楼-- · 2020-07-15 06:50

I had to go to Product > Schema > Edit Schema

Then in the Run dialog, the Executable dropdown was on None. I changed it to the .app file and it worked!

查看更多
ゆ 、 Hurt°
3楼-- · 2020-07-15 06:54

So, I'm not sure this is the actual answer, but I seem to have found a procedural sequence that works.

First: I completely deleted Xcode (again), reinstalled it from scratch (again), and updated all the simulators except 4.3 as well as the command line tools (Xcode > Preferences > Download > Components > All simulators except 4.3 & the command line tools) again.

Second: I also reinstalled PhoneGap 2.1, but I'm not sure this was necessary, it was more of a scorched earth campaign. The problem in Xcode seemed to stem from the Scheme, I kept getting Schemes named "CordovaLib" instead of my project names. If you click on "CordovaLib" on the Scheme/Simulator buttons (the top left hand side is where the available schemes & simulartors are listed, right next to the build & stop buttons), and change the scheme to the project name that helps.

Third: You need to make sure that the location for your app is set to "unique". Do this at Xcode > Preferences > Locations > Locations (not Source Trees) > Derived Data > Advanced > Build Location == Unique > Done.

It seems to help to open the projects in Xcode instead of launching them from Finder, but I'm not convinced that's true, it just seemed to work better, but I could be imagining it.

If I do this on projects I used to have problems on, I can now download them to the simulators & my phone.

This didn't get any responses, but maybe someone else will find it useful.

查看更多
Deceive 欺骗
4楼-- · 2020-07-15 06:57

I had to delete the schema and recreate;

  1. Product >> Schema >> Edit Schema.
  2. Then Manage Schemes.
  3. Then hit "-" to delete schema and
  4. Autocreate Schemes Now.

Then, in Simulator, I reset settings. Then it worked.

查看更多
【Aperson】
5楼-- · 2020-07-15 07:03

before follow please read my edited comments below

  1. Quit XCode
  2. Quit Simulator
  3. go to all the path in the image and delete all these folders enter image description here

  4. Open simulator and in iOS Simulator menu Reset content and settings. Reset it

Start XCode and you should not worry now.

EDIT

I again got issue few days after the error so I tried the steps above but nothing happened :(, 2nd time i reinstalled the xcode after deleting everything related to xcode and simulator and made a new project. For a clean project application run well but again copying all files from older project in same manner, again faced the same issue. So how i fixed that?

You might still need to follow the steps above, not sure these works or not. But i tried to find that the issue starts at the time when i was copying files from old project.

While adding files to the new project a dialog box appears to ask location of existing files and if you see folders option with 2 radio buttons then by default Create group of any added folder (if needed) is selected. Everything went well until i did not touch these options.

Green: Default, Red: user selected

copying existing files to xcode project

But problem started appearing again when for a Resources folder I used the 2nd radio button that says, Create folder references for any added folder. When I removed this folder reference and cleaned project, application ran well. Adding same folder with Create group of any added folder (if needed) option worked also well. Whenever I chose 1st radio button, application showed same issue.

Create group of any added folder (if needed)

and

Create folder references for any added folder

I believe you understand difference between these 2 options i.e. folder colors to yellow and folder colors to blue! Hope this helps all other people also but it is really frustrating and i request apple to fix this bug ASAP :( :(

查看更多
我欲成王,谁敢阻挡
6楼-- · 2020-07-15 07:11

I had a similar situation happen when I was trying to run my first HelloWorld app for Phone Gap iOS.

It turned out for me the executable was missing from Edit schema dialog. Very odd since it ran fine a few times and then it stopped working until I found this dialog.

You can find this dialog in Product -> Edit Scheme --> Info --> Executable (make sure it is not empty).

Although, you found your solution this is a quick check that may help others.

查看更多
虎瘦雄心在
7楼-- · 2020-07-15 07:14

I resolved the problem by changing the active schema to HelloWorld instead of CordovaLib.

Product->Scheme->HelloWorld - make sure the checkmark is beside this item instead of CordovaLib.

查看更多
登录 后发表回答