无法自动选择Xcode项目

时间:2016-06-19 14:34:30

标签: ios xcode7 cocoapods

当我输入" pod install"在一个正确的目录中我总是得到这个

分析依赖关系

[!] Could not automatically select an Xcode project. Specify one in your Podfile like so:

    project 'path/to/Project.xcodeproj'

podfile

platform :ios, '8.0'
use_frameworks!

target 'Posting' do
pod 'ALCameraViewController'

end

我在可以找到Podfile的项目目录中。

20 个答案:

答案 0 :(得分:40)

我的文件夹中有一个旧的.xcodeproj文件,所以有2个。我删除了旧的,它有效!

答案 1 :(得分:10)

将Podfile添加到指定项目路径的项目行

target 'MyGPSApp' do
  project 'FastGPS'
  ...
end

细节: https://guides.cocoapods.org/syntax/podfile.html#project

答案 2 :(得分:9)

这发生在我身上,我有我的" podfile"在子文件夹而不是主目录,例如〜/ MyProject / MyProject / podfile而不是〜/ Myproject / podfile

希望这有帮助!

答案 3 :(得分:6)

platform :iOS, '8.0'
use_frameworks!

target 'Posting' do
project 'projectpath/project.xcodeproj'
pod 'ALCameraViewController'
end

答案 4 :(得分:2)

将存储库移至外部驱动器时出现此错误。

我的解决方案是将存储库移至主驱动器。

答案 5 :(得分:1)

我在意外删除'。xcodeproj'文件时出现此问题。

答案 6 :(得分:1)

You should specific project path inside pod file

platform :ios, '8.0'
   use_frameworks!

   project 'PATH_TO_PROJECT/YOUR_PROJECT_NAME.xcodeproj'
    target 'Posting' do
    pod 'ALCameraViewController'

end

答案 7 :(得分:1)

每个目标都接受一个声明。 在平台之后,在文件顶部添加一行:

project '<Project>.xcodeproj'

target '<Project>' do
 #bla bla bla
end

target '<Project>-tvOS' do
 #bla bla bla
end

答案 8 :(得分:1)

这似乎是将附加文件添加到Xcode的问题。万一您要进行故障排除,请查看可能已添加的其他文件。在Xcode上或直接在文件中。

在我的情况下是这样的:import numpy as np import matplotlib.pylab as plt from scipy.optimize import curve_fit dname=r'my_computer_directory' **#replace with your own directory name** fname='free_fall_run18_csv.csv' dfname ='{0:s}/{1:s}'.format(dname,fname) data01=np.genfromtxt(dfname,delimiter=',',skip_header=1) # data01 is a ndarray # skip one header -> skip_header=1 # csv -> delimiter=',' count = 0 with open(fname, 'r') as f: for line in f: count +=1 n1 = count-1 print ('Number of data points is', count-1) t = data01[:,0] y = data01[:,1]*(-1) # remove any negative times t_temp=t[np.where(t>0)] y_temp=y[np.where(t>0)] def myline1(t,a,b,c): y=a*t**2+b*t+c return y g=-9.81 a0=g/2 b0=0 c0=0 popt0,pcov0 = curve_fit(myline1,t_temp,y_temp,p0=[a0,b0,c0]) a0=popt0[0] b0=popt0[1] c0=popt0[2] y_hat1=a0*t_temp**2+b0*t_temp+c0 #fig = plt.figure() plt.plot(t_temp,y_temp, '.', label = 'Height vs Time') plt.grid() #show grid plt.title('Height vs Time') plt.legend() plt.xlabel('Time [s]') #label axis plt.ylabel('Height [m]') #label axis plt.show() #show figure plt.plot(t_temp,y_temp, '.', label = 'Height vs Time') plt.plot(t_temp,y_hat1, '-', label = 'Height vs Time with curve_fit()') plt.grid() #show grid plt.title('Height vs Time with curve_fit()') plt.legend() plt.xlabel('Time [s]') #label axis plt.ylabel('Height [m]') #label axis plt.show() #show figure #.csv data Time (s),Position (m) 0,0.152 0.025,0.152 0.05,0.152 0.075,0.152 0.1,0.151 0.125,0.151 0.15,0.151 0.175,0.151 0.2,0.15 0.225,0.15 0.25,0.151 0.275,0.151 0.3,0.151 0.325,0.15 0.35,0.15 0.375,0.149 0.4,0.148 0.425,0.147 0.45,0.146 0.475,0.145 0.5,0.144 0.525,0.143 0.55,0.143 0.575,0.143 0.6,0.144 0.625,0.144 0.65,0.145 0.675,0.146 0.7,0.147 0.725,0.148 0.75,0.154 0.775,0.166 0.8,0.184 0.825,0.207 0.85,0.238 0.875,0.273 0.9,0.316 0.925,0.364 0.95,0.417 0.975,0.477 1,0.543 1.025,0.615 1.05,0.694 1.075,0.78 1.1,0.869 1.125,0.964 1.15,1.066 1.175,1.19 1.2,1.105 1.225,1.019 1.25,0.94 1.275,0.867 1.3,0.802 1.325,0.741 1.35,0.687 1.375,0.639 1.4,0.596 1.425,0.56 1.45,0.53 1.475,0.505 1.5,0.488 1.525,0.475 1.55,0.469 1.575,0.468 1.6,0.474 1.625,0.485 1.65,0.502 1.675,0.525 1.7,0.554 1.725,0.589 1.75,0.63 1.775,0.677 1.8,0.73 1.825,0.791 1.85,0.853 1.875,0.924 1.9,1.003 1.925,1.087 1.95,1.19 1.975,1.119 2,1.045 2.025,0.98 2.05,0.921 2.075,0.867 2.1,0.822 2.125,0.781 2.15,0.747 2.175,0.718 2.2,0.696 2.225,0.679 2.25,0.668 2.275,0.663 2.3,0.663 2.325,0.669 2.35,0.682 2.375,0.7 2.4,0.725 2.425,0.755 2.45,0.792 2.475,0.834 2.5,0.882 2.525,0.937 2.55,0.997 2.575,1.064 2.6,1.147 2.625,1.153 2.65,1.092 2.675,1.036 2.7,0.987 2.725,0.945 2.75,0.907 2.775,0.876 2.8,0.851 2.825,0.831 2.85,0.82 2.875,0.813 2.9,0.812 2.925,0.816 2.95,0.826 2.975,0.843 3,0.865 3.025,0.894 3.05,0.929 3.075,0.969 3.1,1.016 3.125,1.068 3.15,1.132 3.175,1.166 3.2,1.113 3.225,1.066 3.25,1.026 3.275,0.991 3.3,0.963 3.325,0.94 3.35,0.923 3.375,0.913 3.4,0.908 3.425,0.91 3.45,0.917 3.475,0.93 3.5,0.95 3.525,0.975 3.55,1.006 3.575,1.043 3.6,1.086 3.625,1.141 3.65,1.161 3.675,1.117 3.7,1.078 3.725,1.045 3.75,1.019 3.775,0.998 3.8,0.984 3.825,0.975 3.85,0.972 3.875,0.975 3.9,0.985 3.925,1 3.95,1.022 3.975,1.049 4,1.083 4.025,1.123 4.05,1.174 4.075,1.136 4.1,1.102 4.125,1.074 4.15,1.051 4.175,1.035 4.2,1.025 4.225,1.021 4.25,1.023 4.275,1.03 4.3,1.044 4.325,1.063 4.35,1.089 4.375,1.121 4.4,1.167 4.425,1.148 4.45,1.117 4.475,1.093 4.5,1.075 4.525,1.063 4.55,1.057 4.575,1.056 4.6,1.062 4.625,1.074 4.65,1.091 4.675,1.115 4.7,1.149 4.725,1.161 4.75,1.133 4.775,1.112 4.8,1.096 4.825,1.086 4.85,1.082 4.875,1.084 4.9,1.092 4.925,1.107 4.95,1.127 4.975,1.158 5,1.16 5.025,1.137 5.05,1.121 5.075,1.11 5.1,1.105

删除此文件后,我点击了pod install,并且工作正常。

答案 9 :(得分:1)

错误地在项目文件夹中添加了两个.xcodeproj文件。

这就是为什么pod不确定要为哪个工作的原因。 我只是从项目中删除了不必要的xcodeproj文件。

现在已解决

答案 10 :(得分:0)

我有同样的问题,我通过将podfile移动到主项目文件夹来解决它,在你的情况下: 1-将pod文件移动到'Posting'文件夹,其中有'Posting'子文件夹和'Posting.xcodeproj'文件
2-重新运行'pod install'命令。 3-享受

答案 11 :(得分:0)

我遇到了同样的问题,问题在于我的项目文件夹与iCloud同步,并且.xcodeproj没有完全加载。它在Finder中可见但在终端中不可见。解决方案是打开/关闭.xcodeproj并再次尝试“pod install”

答案 12 :(得分:0)

我遇到了冲突,因为我们在一个团队中工作,我在pods目录下有一个manifest.lock文件,我必须将其删除,然后运行pod install命令并且它有效:)

答案 13 :(得分:0)

这也发生在我身上。我们用git。并经常改变分支。当我更改分支时,Xcode中的一些错误使得项目文件失去了名称。我做了清洁和更换树枝或再拉。 Xcode项目文件已恢复。但是缺少名称的旧文件仍在那里。 git没有检测到这一点,如果你尝试在那里用这个文件进行pod更新,它会提交文件。删除此文件或确保您只有xcode proj文件。这应该解决它

答案 14 :(得分:0)

您是否在项目文件夹中包含了整个ALCameraViewController存储库?我最初这样做了,我得到了同样的错误。返回repo并按照README.md文件的步骤进行操作。

如果您确实包含了整个仓库,我还建议您删除项目中包含的所有文件夹,这些文件夹来自ALCameraViewController仓库。然后尝试再次在Podfile中安装repo,错误应该消失。

答案 15 :(得分:0)

我将项目存储在Icloud中,当我将其移动到桌面时,终端找到了该项目并允许我安装POD。

答案 16 :(得分:0)

奇怪的是,我在同一目录中有2个.xcodeproj文件。我想我重复了一个。它在工作区中显示为红色,当我移除它时,它工作正常。

答案 17 :(得分:0)

我按照以下新Podfile解决了问题

pod init
pod install

答案 18 :(得分:0)

对于我来说,以下解决方案有效

由于Podfile和.xcodeproj处于同一级别,因此我在文件顶部添加了project 'oceanview.xcodeproj'

所以我的Podfile如下所示,

platform :ios, '9.0'
project 'abc.xcodeproj' #added this line
target 'abc' do
end

然后运行命令pod install

答案 19 :(得分:0)

对于较新版本的 xcode(即 12.4 及更高版本),请改用此目标:

  post_install do |installer|
   installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
  end
 end
end

请注意,对于此解决方案,我们使用版本 10.0 作为我们的目标。 祝你好运