xcodebuild says does not contain scheme

后端 未结 10 1568
天命终不由人
天命终不由人 2020-12-04 05:26

I have a curios issue.

I have a project that I\'ve worked on and always built from the XCode IDE, and it worked fine. Now I\'m setting up Bamboo to build the projec

相关标签:
10条回答
  • 2020-12-04 06:04

    I faced this issue and even if some of the answers here actually provide the solution, I didn't find it very clear. So I will just add one more. In a nutshell how to share a schema from excode.

    Navigate to Product > Scheme > Manage Schemes

    You will then be shown a list of schemes, with each denoted as being shared or not. Just check the ones that you want to share (it may be different ones for dev and prod builds)

    Images taken from this article https://developer.nevercode.io/docs/sharing-ios-project-schemes

    0 讨论(0)
  • 2020-12-04 06:18

    For anyone with Xcode 11.4 trying to find "Shared" button on scheme, it's now moved into the individual scheme.

    1. Select the scheme you want
    2. Press "Edit"
    3. Check the "Shared" box

    0 讨论(0)
  • 2020-12-04 06:20

    Most of the answers would suggest you to make your scheme shared using Xcode, then commit changes to repo. That works, of course, but only if you have access to source code and have rights to commit changes, and couple of other assumptions.

    But there's a number of "what ifs" to consider

    • What if you just can't modify the Xcode project for some reason?
    • What if you create a new scheme automatically on CI server?
      This actually happens quite often. If you use test automation framework, like Calabash, you'll normally end up duplicating an existing target, which automatically duplicates a scheme as well, and the new scheme is not shared, even if the original scheme was.

    Ruby & xcodeproj gem

    I would recommend using xcodeproj Ruby gem. This is a really cool open source tool that can help you to automate tons of Xcode-related tasks.

    Btw, this is the gem used by CocoaPods to mess around with your Xcode projects and workspaces.

    So install it

    sudo gem install xcodeproj
    

    Then write a simple Ruby script to re-share all the schemes, the gem has recreate_user_schemes method for that purpose

    #!/usr/bin/env ruby
    require 'xcodeproj'
    xcproj = Xcodeproj::Project.open("MyProject.xcodeproj")
    xcproj.recreate_user_schemes
    xcproj.save
    

    It doesn't just copy scheme files form user's folder to xcshareddata/xcschemes, it also creates those files first by parsing the pbxproj file.

    0 讨论(0)
  • 2020-12-04 06:20

    I want to add solution for my case related to this thread. This one is for you who clone existing project, with all the schemes you need are already being shared:

    , with fastlane lanes correctly display all your lanes including all your schemes:

    , but fastlane gym only show main schemes (not dev and test schemes):

    The solution is to uncheck the shared option for schemes that not listed by fastlane gym and then check it again. It will generates .xcscheme for the schemes:

    Now, if you check with fastlane gym, all the schemes will be listed:

    Then you should commit those .xcshemes file to the repository, so other developer who clone the project will get the files.

    0 讨论(0)
提交回复
热议问题