'pod install' doesn't update an existing pod

前端 未结 4 521
广开言路
广开言路 2021-01-31 14:57

I am trying to update my pod using pod install and finding that it doesn\'t update properly unless I delete the original pod.

Is t

相关标签:
4条回答
  • 2021-01-31 15:37

    If your project is configured correctly, you should be able to delete the entire Pods directory and run pod install. I find that this is sometimes the best solution when having issues with pods not being installed properly.

    Note: If you begin getting errors such as this when you build:

    diff: /../Podfile.lock: No such file or directory
    diff: /Manifest.lock: No such file or directory
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    

    ... you may need to close and reopen the project in Xcode.

    Warning: make sure all the files in your Pods directory are going to be recreated before deleting the Pods directory. (I.e. make sure you didn't manually modify or add files to the Pods directory.)

    0 讨论(0)
  • 2021-01-31 15:38

    I'm not sure from which version, but if you update your cocoapods installation to the latest version, you'll find two new commands to help with this.

    pod outdated
    

    This will list all pods that have updates available.

    pod update
    

    This will update the pods listed in the previous command

    0 讨论(0)
  • 2021-01-31 15:42

    You can add the verbose tag and see if there is an error showing up during the update.

    pod install --verbose
    

    Using --verbose is the best way to find out what is going on. Maybe there is a problem with the repo it is trying to update from. Hard to say.

    0 讨论(0)
  • 2021-01-31 15:43

    I think reader of this Question must understand difference between

    pod install vs. pod update

    Many people starting with CocoaPods seems to think that pod install is only used the first time you setup a project using CocoaPods and pod update is used afterwards. But that's not the case at all.

    • Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods.
    • Use pod update [PODNAME] only when you want to update specific pod to a newer version.
    • Use pod update only when you want to update every pod to a newer available version.

    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')

    0 讨论(0)
提交回复
热议问题