ios 如何正确创建迦太基购物车文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30401465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 06:03:21  来源:igfitidea点击:

How to correctly create carthage cartfile?

ioscarthage

提问by YichenBman

I'm looking into cartfile. Can't wait to "simply create a cartfile" like all the instructions say to do.

我正在查看购物车文件。迫不及待地像所有说明所说的那样“简单地创建一个购物车文件”。

Only... how do you "simply" create a Cartfile?

只有...你如何“简单地”创建一个 Cartfile?

I've created a plain text document, named it cartfile and copied some dependencies in it.

我创建了一个纯文本文档,将其命名为cartfile 并在其中复制了一些依赖项。

Ran carthage updateinside my root project directory

carthage update我的根项目目录内

Get this error: "No such file in directory"

收到此错误:“目录中没有这样的文件”

Downloaded an example carthage project and the Cartfile is actually an executable.. So how do I "simply create" a Cartfile, cause there aren't any instructions on how to

下载了一个示例 carthage 项目,Cartfile 实际上是一个可执行文件..那么我如何“简单地创建”一个 Cartfile,因为没有任何关于如何创建的说明

回答by BenJammin

From the command line, navigate to your project directory.

从命令行,导航到您的项目目录。

touch Cartfile

Now the Cartfile is created, make it executable with:

现在 Cartfile 已创建,使用以下命令使其可执行:

chmod +x [YourDirectory/Cartfile]

You can open it with any text editor. Then insert whatever library and source you want (Example: github "SwiftyJSON/SwiftyJSON" >= 2.1.2)

您可以使用任何文本编辑器打开它。然后插入任何你想要的库和源(例如:github "SwiftyJSON/SwiftyJSON" >= 2.1.2

回答by Suragch

Carthage Tutorial: Getting Startedis a must read. It explains things much better than the Carthage documentationdoes.

迦太基教程:入门是必读的。它比Carthage 文档更好地解释了事情。

Steps

脚步

  1. In a Terminal, cdto the root directory of the project that you want to add the framework to. This should be the same directory as your *.xcodeproj file.

    cd ~/Path/To/Your/Project/
    
  2. Create an empty file called Cartfile like this:

    touch Cartfile
    
  3. Open that file with Xcode:

    open -a Xcode Cartfile
    
  4. Paste the framework info that you need into the Cartfile. For example:

    github "stephencelis/SQLite.swift" ~> 0.10.1
    
  5. Close the file in Xcode and in Terminal run the following command to make Carthage update the dependencies in your project. (You should still be in the same directory as your Cartfile.)

    carthage update --platform iOS
    
  1. 在终端中,cd到要将框架添加到的项目的根目录。这应该与您的 *.xcodeproj 文件位于同一目录。

    cd ~/Path/To/Your/Project/
    
  2. 创建一个名为 Cartfile 的空文件,如下所示:

    touch Cartfile
    
  3. 使用 Xcode 打开该文件:

    open -a Xcode Cartfile
    
  4. 将您需要的框架信息粘贴到 Cartfile 中。例如:

    github "stephencelis/SQLite.swift" ~> 0.10.1
    
  5. 在 Xcode 中关闭该文件并在终端中运行以下命令以使 Carthage 更新项目中的依赖项。(您应该仍与 Cartfile 位于同一目录中。)

    carthage update --platform iOS
    

Notes

笔记

  • Using the method above, there is no need to change the execution permissions of the Cartfile.
  • You will still need to add the framework link to your project before you can use it. See the tutorial I linked to at the top for more information.
  • 使用上述方法,无需更改 Cartfile 的执行权限。
  • 您仍然需要将框架链接添加到您的项目中,然后才能使用它。有关更多信息,请参阅我在顶部链接的教程。

回答by chanduthedev

Install by running below command if carthage is not installed.

如果未安装 carthage,请通过运行以下命令进行安装。

brew install carthage

brew 安装迦太基