---
title: "命令行找不到scheme问题处理"
author: "sailqi"
date: "2016-03-15T17:00:14Z"
tags: ["Scheme", "iOS"]
categories: ["研发管理"]
slug: "scheme"
draft: false
lastmod: "2016-03-15T17:00:13Z"
id: 2283188
url: "https://sailqi.iteye.com/blog/2283188"
---

## **一、问题描述**

直接拉取代码到本地之后，通过命令xcodebuild -list找不到scheme（通过xcode打开后即可找到），如下图：

![](http://dl2.iteye.com/upload/attachment/0115/8143/fca46662-8c6e-37a0-bc4a-230c8b14b392.jpg)  
 

**二、解决方法**

由于需要通过Jenkins进行持续构建，拉取代码后必须通过命令行打包，因此手动打开xcode显然不现实。解决方法如下：

1、事先通过xcode打开工程，通过Scheme &gt; Manage Schemes ，将scheme设置为shared：

![](http://dl2.iteye.com/upload/attachment/0115/8147/4de0f7ba-9068-31ec-8bf3-ce65cfd94772.jpg)  
   
2、将生成的文件xx.xcodeproj/xcshareddata提交到代码版本库。

3、通过Jenkins等工具拉取代码之后，即可找到scheme：

![](http://dl2.iteye.com/upload/attachment/0115/8145/659cfb3c-5f62-37f7-a3fa-7470e750bb37.jpg)  
  

参考资料：[http://stackoverflow.com/questions/13500793/xcodebuild-commands-give-different-results-when-run-from-the-command-line-than-w](http://stackoverflow.com/questions/13500793/xcodebuild-commands-give-different-results-when-run-from-the-command-line-than-w)