在Xcode 7.3中使用Cocoapods [英] Using Cocoapods in Xcode 7.3

查看:54
本文介绍了在Xcode 7.3中使用Cocoapods的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用终端安装了Cocoapods,一切顺利,但是我似乎无法弄清楚如何将其集成到我的Xcode项目中。我将目录更改为包含Xcode项目的主文件夹,然后键入 $ pod init ,这将在Xcode项目文件夹中创建一个初始Podfile。然后,我在Xcode中打开Podfile,使其看起来像这样:

I installed Cocoapods using the terminal and everything went well, but I cant seem to figure out how to integrate it into my Xcode project. I change the directory to the main folder that contains the Xcode project and type $ pod init which creates an initial Podfile in the Xcode project folder. Then I open the Podfile in Xcode and make it look like this:

platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
  pod "ForecastIO"
end

接下来,我回到终端并输入 $ pod install ,一切顺利。问题是没有文件显示在Xcode的项目目录中,但是它们位于包含所有项目文件的Finder文件夹中。我尝试将新文件手动拖动到项目目录中,但是其中一些仍然没有显示,并且Podfile代码的语法未突出显示。同时也不允许我导入应该安装的cocoapod。我不熟悉所有这些,可能遗漏了一些简单的东西,但我无法弄清楚。

Next, I go back to the terminal and type $ pod install and everything goes well. The problem is none of the files show up in the project directory inside of Xcode, yet they are in the Finder folder that contains all the project files. I tried dragging the new files into the project directory manually, but some of them still do not show up and the syntax for the Podfile code is not highlighted. Also doesn't allow me to import the cocoapod that it supposedly just installed. I am new to all of this and I'm probably missing something simple, but I cannot figure it out. Any help is appreciated.

Tl; dr如何将ForecastIO Cocoapod实现到Xcode项目中?

对ForecastIO Pod的信息: https://cocoapods.org/pods/ForecastIO

Lint to ForecastIO Pod Info: https://cocoapods.org/pods/ForecastIO

推荐答案

在需要打开YourProjectHere.xcworkspace时打开YourProjectHere.xcodeproj

Your opening the YourProjectHere.xcodeproj when you need to be opening the YourProjectHere.xcworkspace


  1. 在Xcode中创建一个新项目

  1. Create a new project in Xcode

进入终端并从同一终端运行此命令YourProjectHere.xcodeproj所在的文件夹

Go into your terminal and run this command from the same folder that your YourProjectHere.xcodeproj is located in

$ pod init


  • 编辑Podfile

  • 从YourProjectHere.xcodeproj所在的文件夹中运行此命令

  • Edit your Podfile
  • Run this command from the same folder that your YourProjectHere.xcodeproj is located in

    $ pod install
    


  • 现在应创建一个工作区。从YourProjectHere.xcodeproj所在的文件夹中运行此命令

  • A workspace should now be created. Run this command from the same folder that your YourProjectHere.xcodeproj is located in

    $ open YourProjectHere.xcworkspace/
    


  • 这篇关于在Xcode 7.3中使用Cocoapods的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆