当前位置:网站首页>Relevant knowledge points of cocoapods
Relevant knowledge points of cocoapods
2022-06-12 13:41:00 【Li. CQ】
pod technological process

pod cache ~/Library/Caches/CocoaPods

Search and install Cocoapods A library on , The general implementation process is :
1、 from search_index.json Find the corresponding version of the library in podspec File and download it to Specs/Release In the folder
2、 According to the podspec In the document source Medium git Address , Download the corresponding version of the library to Pods/Release In the folder
Push the locally developed libraries to Cocoapods Warehouse time , The general implementation process is :
1、 perform pod spec lint XXX.podspec when , If you do not rely on other libraries , Will be in Specs/External The library in the file generates the corresponding version of podsepc file , And change the file name hash
2、 Will be podspec Download the corresponding library in the file to Pods/External In the folder
3、 If the published library depends on other Cocoapods When publishing libraries on , Will depend on the library podspec Download the file to Specs/Release In the folder , The dependent libraries are downloaded to Pods/Release In the folder
pod install Operation principle analysis
- analysis dependency
- Compare local Pod and podfile.lock The version in the file , If inconsistent, it will indicate that there is a risk .
- contrast podfile Is there a change ,add/remove pod rely on
- If there is , Two lists will be generated , One is need add Of pods, One is need remove Of pods.
- If there is remove Of , Delete remove Of pods( Will delete podfile.lock The version in depends on ).
- Add what you need pods rely on
- here , If it's regular CocoaPods library ( be based on git), Will go first :
- Spec Find the corresponding Pods Folder
- Find the corresponding tag
- git clone Down the code and copy To Pod Under the table of contents
- function pre-install hook
- Generate Pod Project
- Will be pod Add files to the project
- Add corresponding framework、.a library 、bundle etc.
- Link header file , Generate Target
- function post-install hook
- Generate podfile.lock , Then make a copy of the file mainfest.lock And put it in Pod In the folder .( If appear The sandbox is not sync with the podfile.lock Such mistake , said manifest.lock and podfile.lock The documents are inconsistent ), At this time, it is generally necessary to re run pod install command .
- Configure the original project file (add build phase)
- Added Embed Pods Frameworks
- Added Copy Pod Resources
// - among ,pre-install hook and post-install hook It can be understood as a callback function , Is in podfile Li for install Before or after ( The project is generated but has not been written to disk ) Executable logic , The logic is :
// - Be careful :pod install Give priority to Podfile Version information specified in , Second, follow Podfile.lock Install the corresponding dependent libraries according to the version information specified in .
pre_install do |installer|
# Do something before installation hook
end
post_install do |installer|
# Do something after installation hook
end
pod Operations in the command
- Use pod update When ordered , Will podfile Copy the folder in the address of the source in to ~/.cocoapods/repos in ;
- Use pod spec lint --sources=‘xxx’ When , Will source Copy the folders in the addresses of all sources specified in to ~/.cocoapods/repos in ;
- pod spec lint --verbose --allow-warnings --use-libraries --skip-import-validation It will be local ~/.cocoapods/repos Verify this component in all sources in
- Use pod repo push REPO_NAME SPEC_NAME.podspec When you give an order , Will SPEC_NAME.podspec Files added to ~/.cocoapods/repos/REPO_NAME/SPEC_NAME/pod Of documents version/SPEC_NAME.podspec in ;
Command parsing
- pod install :
- according to Podfile Documents or Podfile.lock Download and import the corresponding third-party library , Check whether the resource configuration file needs to be updated , If there is an update , Then download the latest version .
- pod update
- Pull the latest remote directory first , Update again according to the resources in the directory pod
- It doesn't care Podfile.lock Whether there is , Will read Podfile Frame information of the file . If your podfile Each library in has a version specified , without , So every time I pull the latest library .
- pod update --no-repo-update
- Update the library only according to the local directory , No need to pull the remote .
- pod update xxx
- Find a framework that updates the latest version of the specified library name
- pod repo update
- Used to update local cocoapods Of spec Resource allocation information .
- Maybe you never use pod repo update You can also get the latest library , That's because you're using pod update Yes, it will be executed by default pod repo update , So you will find that if your pod Too many library references , Every time pod update It's very slow , If the network is not good, it is often broken , Because you are updating pod when , Also updated the resource directory .
Manifest.lock yes Podfile.lock Copy of , It's in Pods Inside the directory . It works like this , We usually don't put Pods Files are put into version management , But the Podfile.lock Put it in version management . In this case, whether the code needs to be updated after pulling pod, By comparing the local Manifest.lock And remote Podfile.lock Whether it is the same or not .
边栏推荐
- import torch_ Geometric loads some common datasets
- 【SemiDrive源码分析】【X9芯片启动流程】26 - R5 SafetyOS 之 LK_INIT_LEVEL_TARGET 阶段代码流程分析(TP Drvier、Audio Server初始化)
- 事件的传递和响应以及使用实例
- Implementing tensorflow deep learning framework similarflow with numpy
- import torch_ Data view of geometric
- 2064: [example 2.1] exchange value
- Rk3399 platform development series explanation (kernel debugging chapter) 2.50 use of systrace
- 2065: [example 2.2] sum of integers
- Informatics Olympiad all in one 2059: [example 3.11] buy a pen
- D1 Nezha Development Board understands the basic startup and loading process
猜你喜欢

聊聊MySQL的10大经典错误

Automatic Generation of Visual-Textual Presentation Layout

【刷题篇】抽牌获胜的概率

Application of binary search -- finding the square root sqrt of a number

Qualcomm platform development series (Protocol) QMI brief introduction and usage

torch_ geometric message passing network

Innovation training (x) advanced interface beautification

数据类型转换和条件控制语句

创新实训(十一)开发过程中的一些bug汇总

A method of quickly creating test window
随机推荐
2063: [example 1.4] cattle eat grass
Codeforces 1629 D. pecuriar movie preferences - simple thinking, palindrome strings
A method of quickly creating test window
【SemiDrive源码分析】【X9芯片启动流程】25 - MailBox 核间通信机制介绍(代码分析篇)之 RPMSG-IPCC RTOS & QNX篇
Implementing tensorflow deep learning framework similarflow with numpy
Codeforces 1629 F2. Game on sum (hard version) - Yang Hui's triangle, violence, finding rules
Install RPM package offline using yum
单向环形链表实现约瑟夫环
import torch_ Geometric first graph network example
Actual combat | realizing monocular camera ranging by skillfully using pose solution
1004: character triangle
Resume NFT platform trustrecruit joined Octopus network as a candidate application chain
AWLive 结构体的使用
Software construction 03 regular expression
Implementing pytorch style deep learning framework similartorch with numpy
2064: [example 2.1] exchange value
苹果电脑上MySQL安装完成找不到怎么办
How to solve the problem of data table query error when SQLite writes the registration function?
go-zero 微服务实战系列(二、服务拆分)
Successful job hopping Ali, advanced learning