Writing in the front

If you’re a multi-developer, you’ve probably had a bit of a problem with your podfile. lock file. If you’re a solo developer you don’t have the problem of saying you have a podfile. lock file.

The podfile. lock file

Note the version numbers of all third-party frameworks when you last updated Pods. The podfile. lock file mainly contains: PODS, DEPENDENCIES, SPEC REPOS, SPEC CHECKSUMS, and PODFILE CHECKSUM record the version number of each pod, the CHECKSUM (SHA1) of the podspec.json file that is dependent on other libraries. This information ensures that when multiple people collaborate, everyone is using the same version of the third-party library.

Two. Pod common instruction difference

pod install

  • ifPodfile.lockFile does not exist, will be based onPodfileFiles are installed by third-party frameworks and generatedPodfile.lockfile
  • ifPodfile.lockThe file exists and will be based onPodfile.lockThe version number of the file to install the third-party framework

pod update

  • According to thePodfileFiles to install third-party frameworks
  • Will all third party frameworksUpdate to the latest versionAnd create onePodfile.lockfileOverwrites the original podfile. lock file

pod install/update –no-repo-update

Does not run until the framework is installedpod repo update, meaning to use the locally cached framework version without checking the server version

Pod Install/POD Update Process description

  • Through thepod installorpod updateInstructions are executed before the framework is installedpod repo updateWhether the latest version of the framework is installed in the project depends on the installation method:pod install(Specify the version) andpod update(Latest version)
  • In the first executionpod installInstruction,podfile.lockIt doesn’t exist yet. It’s based onpodfileTo integrate the framework. If the framework version number is specified, the specified version is installed; if not, the latest version is installed and automatically generatedpodfile.lockfile
  • Execute again laterpod installInstructions will be based onpodfile.lockTo install the framework.
  • Even if the server has the latest version, passpod installThe directive also does not install the latest third party frameworks, only according topodfile.lockIn the recorded version to install

Application in projects

  • Podfile.lockVersion control should be added to ensure that the partners of the dependent library version is consistent, to prevent difficult to findbugIn addition, version control should be added at the time of initial project creation.
  • PodfileSyntax should be as strict as possible, and it is best to specify explicit dependency library versions.
  • understandpod installpod updateAnd the difference between themPodfile.lockThe impact of fair use. It’s usually multi-purposepod install, when neededpod update.

Write in the back

Podfile is more like a version constraint, whereas podfile. lock is the version you actually use. If you are asked to determine which version of a tripartite library your app uses, you should not look for Podfile, but rather the file podfile. lock.

Finally learn harmoniously, not impatient. I’m still me, a different color of fireworks.