Xcode: app builds but won't run and the executable can't be selected in schemes
Asked Answered
V

1

7

I'm working with multiple people on an app in Xcode. Today I started Xcode and tried to run the app on my simulator, but it doesn't run. It builds and gives no errors, but the app won't appear on the simulator. As many questions suggested, I needed to select my executable in the schemes (Manage schemes -> ‘Scheme name’ -> Run -> Info -> ‘Executable dropdown’). But when I edit the scheme, my executable is not visible in the dropdown. Also the .app won't appear in the products folder as it usually does. How do I get it back?

I've tried many things like deleting Derived data, deleting the project and checkout again via version control, I even deleted everything related to Xcode and downloaded it again. But none of this worked.

I also read somewhere that AppCode (IDE from Jetbrains) stores the .app somewhere else. Perhaps this causes an issue with Xcode? But as I said, even if I download the bare project from source control, it builds but doesn't run.

I'm working with Xcode 9.1 at the moment. Also working With AppCode Version 2017.3 EAP.

Verified answered 13/11, 2017 at 15:50 Comment(5)
stupid thought - are you opening a project file? or a workspace? What do you normally open? has someone added pods to the project for the first time etc.?Ralfston
@Ralfston I'm opening a workspace. We're using Cocoapods. But pods have been in the project since the beginning, so that's probably not the cause of this.Verified
may there is an issue in pbxproject fileSpotted
@SumitDhariwal I could've sworn that I checked the history of this file. But maybe because the file is so large I might have skipped something. There were a total of 3 lines removed which contained MyProject.app in it and if I put it back on the exact same location, I could select an executable in schemes. Could you create an answer with this info? Then I can accept itVerified
In my case I've downloaded app(library) from GitHub and was unable to get the app run on the simulator.It had .xcodeproj, further exploring the subfolders i could find other .xcworkspace and .xcodeproj files. Finding correct .xcworkspace sorted the issueToponym
F
5

Maybe the project.pbxproj file does not have the correct reference to the app executable. This might happen when a merge conflict occurs and is not solved correctly.

Try to look for differences in the project.pbxproj file, concerning the occurrences 'YourApp.app' and restore or adjust these where needed. To look for these differences use the commit history in version control tools like Git Kraken.

When this is done, clear derived data and clean the project. Then build.

The app executable should pop up again now :)

Friede answered 23/11, 2017 at 10:38 Comment(1)
I had multiple schemes for my App and I ended up deleting and recreating the broken scheme. The cause of the problem was indeed not correctly solving merge conflicts.Boundary

© 2022 - 2024 — McMap. All rights reserved.