美文网首页iOS开发者日记iOS收藏
记:CocoaPods 安装FMDB第一次尝试

记:CocoaPods 安装FMDB第一次尝试

作者: DeadRabbit | 来源:发表于2016-11-18 15:33 被阅读3620次

    错误

    • 错误类型 1:
    [!] Invalid `Podfile` file: syntax error, unexpected ',', expecting end-of-input
    'FMDB','~>2.6.2'
    [!] Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting end-of-input
    platform:ios'8.0'
    [!] The dependency `FMDB (~> 2.6.2)` is not used in any concrete target.
    [!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.
    

    错误原因:podfile的配置不对,正确的配置如下:
    platform :ios, '8.0'
    target "no_name" do
    pod 'FMDB', '~> 2.6.2'
    end
    注:标点和空格 一定要正确

    • 错误类型 2:
     [!] Unable to satisfy the following requirements:
    `FMDB (~> 2.6.2)` required by `Podfile`
    None of your spec sources contain a spec satisfying the dependency: `FMDB (~> 2.6.2)`.
    You have either:
     * out-of-date source repos which you can update with `pod repo update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.
    Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
    
    执行下面命令
    sudo gem install cocoapods --pre
    报错
    ERROR:  While executing gem ... (Errno::EPERM)
        Operation not permitted - /usr/bin/pod
    
    执行下面命令
    // 移除本地master
    sudo rm -fr ~/.cocoapods/repos/master
    // 移除本地缓存
    sudo rm -fr ~/Library/Caches/CocoaPods/
    // 重新setup,如果网速较慢,可以在后面加上 --verbose
    pod setup
    报错
    Setting up CocoaPods master repo
    [!] The `master` repo requires CocoaPods 1.0.0 -  (currently using 0.36.4)
    Update CocoaPods, or checkout the appropriate tag in the repo.
    localhost:no_name Loji$ sudo gem update cocoapods
    Password:
    Updating installed gems
    Updating cocoapods
    ERROR:  While executing gem ... (Errno::EPERM)
        Operation not permitted - /usr/bin/pod
    
    执行命令
    sudo gem install -n /usr/local/bin cocoapods
    成功Successfully installed cocoapods-1.1.1
    重新执行:pod setup
    出现蓝色字体Setup completed
    pod install  成功
    ```
    ####CocoaPods常用命令
    1. pod install
    根据Podfile文件指定的内容,安装依赖库,如果有Podfile.lock文件而且对应的Podfile文件未被修改,则会根据Podfile.lock文件指定的版本安装。
    每次更新了Podfile文件时,都需要重新执行该命令,以便重新安装Pods依赖库。
    2. pod update
    若果Podfile中指定的依赖库版本不是写死的,当对应的依赖库有了更新,无论有没有Podfile.lock文件都会去获取Podfile文件描述的允许获取到的最新依赖库版本。
    3. pod search <第三方库>
    4. pod --version 查看版本
    5. sudo gem uninstall cocoapods 卸载cocoapods

    相关文章

      网友评论

        本文标题:记:CocoaPods 安装FMDB第一次尝试

        本文链接:https://www.haomeiwen.com/subject/vpdrpttx.html