Jacky's blog
首页
  • 学习笔记

    • web
    • android
    • iOS
    • vue
  • 分类
  • 标签
  • 归档
收藏
  • tool
  • algo
  • python
  • java
  • server
  • growth
  • frida
  • blog
  • SP
  • more
GitHub (opens new window)

Jack Yang

编程; 随笔
首页
  • 学习笔记

    • web
    • android
    • iOS
    • vue
  • 分类
  • 标签
  • 归档
收藏
  • tool
  • algo
  • python
  • java
  • server
  • growth
  • frida
  • blog
  • SP
  • more
GitHub (opens new window)
  • iOS 学习开发指南
  • 调研

  • 其他

    • iOS术语
    • swift语法
    • oc语法
    • 原理
    • 项目构建
    • iPhone技巧
    • ui
    • pod
      • pod 使用
      • 其他
        • pod 版本控制
        • podspec 文件
        • Unable to find a specification
        • pod install vs. pod update
      • 链接
    • xcode的使用
  • 《iOS》
  • 其他
Jacky
2023-10-06
目录

pod

cocoapods 的安装 ruby 章节

# pod 使用

-> % pod
Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache         Manipulate the CocoaPods cache
    + deintegrate   Deintegrate CocoaPods from your project
    + env           Display pod environment
    + init          Generate a Podfile for the current directory
    + install       Install project dependencies according to versions from a
                    Podfile.lock
    + ipc           Inter-process communication
    + lib           Develop pods
    + list          List pods
    + outdated      Show outdated project dependencies
    + pdd           Cocoapods plugin for Pinduoduo.
    + plugins       Show available CocoaPods plugins
    + repo          Manage spec-repositories
    + search        Search for pods
    + setup         Setup the CocoaPods environment
    + spec          Manage pod specs
    + trunk         Interact with the CocoaPods API (e.g. publishing new specs)
    + try           Try a Pod!
    + update        Update outdated project dependencies and create new Podfile.lock

Options:

    --silent        Show nothing
    --version       Show the version of the tool
    --verbose       Show more debugging information
    --no-ansi       Show output without ANSI codes
    --help          Show help banner of specified command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

# 其他

# pod 版本控制

guide (opens new window)

  • 限定次要版本

    pod 'Masonry', '~> 1.0.1'

    • pod: 这是 CocoaPods 的命令行工具, 用于管理项目的依赖
    • 'Masonry': 这是要添加的第三方库的名称, 即 Masonry
    • ', ~> 1.0.1': 这是版本号的范围限制。~> 符号表示版本的范围, 它告诉 CocoaPods 可以安装 1.0.1 版本以及更新的次要版本, 但不包括 2.0 及更高的版本。具体来说, ~> 1.0.1 表示可以安装 1.0.1、1.0.2、1.0.3 等等, 但不包括 2.0 及更高的版本

# podspec 文件

CocoaPods 是一个用于管理和共享代码库的依赖管理器, 它允许开发人员将他们的代码库共享给其他开发人员, 并让其他人能够轻松地将这些库集成到他们的项目中。为了将代码库发布到 CocoaPods, 你需要创建一个 .podspec 文件, 这个文件包含了关于你的库的元数据和依赖信息。以下是 .podspec 文件的一些常见字段和用途:

  • name: 库的名称
  • version: 库的版本号
  • summary: 一个简短的描述, 用于描述库的用途
  • description: 详细的描述, 用于描述库的功能和用法
  • homepage: 项目的主页或文档链接
  • license: 使用的许可证类型
  • authors: 作者信息
  • source: 代码库的源文件
  • platforms: 库支持的平台和版本
  • dependencies: 依赖的其他 CocoaPods 库
  • source_files: 库中包含的源文件
  • public_header_files: 公共头文件的路径
  • resources: 与库一起安装的资源文件
  • frameworks: 依赖的系统框架
  • vendored_frameworks: 要打包的外部框架
  • vendored_libraries: 要打包的外部库文件
  • prefix_header_file: 预编译的头文件

这只是 .podspec 文件的一部分, 你可以根据你的库的具体情况来添加或修改这些字段。创建完 .podspec 文件后, 你可以使用 pod lib lint 命令来验证它, 确保没有错误, 然后使用 pod trunk push 命令发布你的库到 CocoaPods 仓库, 使其他开发人员能够通过 CocoaPods 来使用你的库

# Unable to find a specification

参考: https://help.aliyun.com/document_detail/51352.html (opens new window)

  • 检查 repo: pod repo list
  • 确认 lib 是否存在: pod search <lib>
  • 更新 repo: pod repo update 或者 pod install --repo-update
  • 添加指定的 source 到 Podfile, 如
    • source 'https://github.com/CocoaPods/Specs.git'
    • source 'https://github.com/aliyun/aliyun-specs.git'

# pod install vs. pod update (opens new window)

  • pod install:

    This is to be used the first time you want to retrieve the pods for the project, but also every time you edit your Podfile to add, update or remove a pod.

    • Every time the pod install command is run — and downloads and install new pods — it writes the version it has installed, for each pods, in the Podfile.lock file. This file keeps track of the installed version of each pod and locks those versions.

    • When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock.

      • For pods listed in the Podfile.lock, it downloads the explicit version listed in the Podfile.lock without trying to check if a newer version is available
      • For pods not listed in the Podfile.lock yet, it searches for the version that matches what is described in the Podfile (like in pod 'MyPod', '~>1.2')
  • pod update:

    When you run pod update PODNAME, CocoaPods will try to find an updated version of the pod PODNAME, without taking into account the version listed in Podfile.lock. It will update the pod to the latest version possible (as long as it matches the version restrictions in your Podfile).

    If you run pod update with no pod name, CocoaPods will update every pod listed in your Podfile to the latest version possible.

# 链接

  • CocoaPods (opens new window)
  • CocoPods guide (opens new window)
    • podfile syntax (opens new window)
上次更新: 2024/12/01, 17:07:39
ui
xcode的使用

← ui xcode的使用→

最近更新
01
npx 使用指南
10-12
02
cursor
09-28
03
inspect
07-20
更多文章>
Theme by Vdoing | Copyright © 2019-2025 Jacky | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式