1

我知道这个问题之前在这里被问过 - Cocoapods:“没有找到 Xcode 项目,请指定一个!” ,但它仍然没有帮助我。我 i) 调用 - sudo gem install cocoapods ii) 通过将项目拖到终端来更改目录。我通过键入 cd 然后将 cocoapo.xcodeproj(在下图中以蓝色突出显示)拖动到终端来做到这一点 - 在此处输入图像描述

iii) 称为吊舱设置。现在,当我调用 pod init 时,它显示错误,如下面的终端图像所示。我究竟做错了什么 ?如果您需要更多信息,我将非常乐意为您提供帮助。

4

1 回答 1

1

我发现我错了。

我正在编写完整的步骤步骤(尤其是对于新手-(swift 5,xcode 10.2,我的项目名称-cocoapo)。另外,我正在使用 Firebase。

     i) In the terminal type "sudo gem install cocoapods", press return.
      
    ii)open xcode. Right-click on the projectname( in my case cocoaopo) , then click on "show in finder" 

   iii)I was supposed to select all the 4 cocoapo files from the finder, go to files->new folder with selection(4 items),  
    
   iv)then drag that folder to desktop 

    v) Renaname that folder (now on the deskktop)  to the oririginal projectname( in my case, I had named it cococpo).
     
    vi) Go to terminal - 
       a)type cd, give a blankspace, drag the project from the desktop to the terminal to give the complete path of the project. so, in the terminal, complete thing printed was - cd /Users/apple/Desktop/cocoapo 

   b)  type "pod init"  in the terminal.  press  return.

  c) type "open podfile"  in the terminal.  press  return. Now, the podfile opens. 
   d) In the podfile(not textEdit), type the following(eg. for my project name is cocoapo, ios 10.2) -


platform :ios, '9.0'

 target 'cocoapo' do

 use_frameworks!

  pod 'Firebase/Core'

 end

    e) This step is very important - Xcode should be closed. You must  SAVE the podfile, then completely CLOSE the podfile as well. 
   
 f)Now, type "pod install" in the terminal. return key.

  g) Again one more important step -  you should open the file as .xcworkspace, not .xcodeproject. This is how yu shuld do it -  open xcode. Right-click on the projectname( in my case cocoaopo) , then click on "show in finder". now you will see "yourprojectname.xcworkspace" (in my case it was "cocoapo.xcworkspace") in finder. open that.

现在,故障排除-如果出现任何问题:-

 clear derived data, clean build folder, close xcode. In terminal do pod update. reopen xcode. It should work. 
于 2020-03-11T13:29:58.140 回答