美文网首页首页投稿程序员
CocoaPods 新建 第三方+各种坑问题解决方法

CocoaPods 新建 第三方+各种坑问题解决方法

作者: 笨驴爱吃胡萝卜 | 来源:发表于2019-01-10 11:16 被阅读59次
    timg.jpeg

    1.cd pod_project
    2.pod lib create BMWorkVisitor
    3.进入Classes 文件夹 ,添加一个你想要的文件demo文件
    4. 到example 文件夹下
    5. pod update
    6. xcode 重启,看看目录下pod 文件是不是有了
    7. 提交pod 库到远端也是整个的项目

    $ git add . 
    $ git commit -s -m "初始化MyLib 库"
    $ git remote add origin git@git.coding.net:tb/MyLib.git #添加远端仓库
    $ git push origin master #提交到远端仓库
    $ git tag -m "first release" "0.1.0" #打上标签,这个很重要 $ git push --tags #推送tag到远端
    
    

    8.在主目录下 更改 .podspec 文件 ,其中包括source summary description author
    9.pod lib lint
    出现这个

    -> MyLib (0.1.0) MyLib passed validation.
    
    

    10.本地测试MyLib.podspec文件

    pod 'MyLib', :podspec => '../MyLib.podspec’ pod update 
    

    重启

    11.创建一个管理私有源的工程
    pod repo add BMSpecs https://cdgit.bitmain.com/man.yao/BMSpecs.git

    12.提交私有库BM到私有源BMSpecs
    pod repo push BMSpecs BMWPDemo01.podspeco

    出现

    Validating spec -> MyLib (0.1.0) Updating the `MySpecs' repo Already up-to-date.
     Adding the spec to the `MySpecs' repo - [No change] MyLib (0.1.0) Pushing the `MySpecs’ repo
    Username for 'https://git.coding.net': kensla
    Password for 'https://kensla@git.coding.net': To https://
    git.coding.net/kensla/MySpecs.git59b080c..b44123d master -> mast
    
    

    13.如果提示

    [!] Unable to find a pod with name, author, summary, or description matching `BMWorkVisitor`
    
    

    解决 rm ~/Library/Caches/CocoaPods/search_index.json再search 一遍

    -------------------------------------------------------分割线-------------------------------------------------------

    - ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for `BMWSegmentTopBar` depended upon by `BMWIAttendance`
    

    解答:

    pod spec lint BMWIAttendance.podspec --sources='[https://github.com/CocoaPods/Specs.git,https://git.bitmain.com/man.yao/BMBJSpecs.git,https://cdgit.bitmain.com/man.yao/BMSpecs.git](https://github.com/CocoaPods/Specs.git,https://git.bitmain.com/man.yao/BMBJSpecs.git,https://cdgit.bitmain.com/man.yao/BMSpecs.git)'
    

    -------------------------------------------------------分割线-------------------------------------------------------

    pod repo add 完成后,不要忘记pod repo update 一下

    如果让你从新输入用户名密码

    在gitlab 的里面找到

    Access Tokens 里面设置 你的账号密码

    如果你的电脑是个新电脑

    -------------------------------------------------------分割线-------------------------------------------------------

    如果

    pod lib lint。提示

    - ERROR | spec: The specification defined in `/Users/ 。。。。。。。 .podspec` could not be loaded.
    

    解决方式

    pod spec lint --sources='git@[git.tongbin.com](http://cdgit.tongbin.com/):tongbin/BMSpecs.git,[https://github.com/CocoaPods/Specs](https://github.com/CocoaPods/Specs)' --allow-warning
    
    pod lib lint --sources='git@[git.tongbin.com](http://cdgit.tongbin.com/):tongbin/BMSpecs.git,[https://github.com/CocoaPods/Specs](https://github.com/CocoaPods/Specs)' --allow-warnings
    

    -------------------------------------------------------分割线-------------------------------------------------------

    pod repo push <repo-name> <podspec-file-name>.podspec --allow-warnings --use-libraries

    -------------------------------------------------------分割线-------------------------------------------------------

    如果出现

    fatal: refusing to merge unrelated histories`
    

    如果你是git pull或者git pushfatal: refusing to merge unrelated histories
    同理:

    `git pull origin master --allow-unrelated-histories`
    

    -------------------------------------------------------分割线-------------------------------------------------------

    fatal: unable to access '': SSL certificate problem: self signed certificate
    

    解决方法:

    git config --global http.sslVerify false
    

    -------------------------------------------------------分割线-------------------------------------------------------

    pod package YXTCourseSDK.podspec --force --embedded --no-mangle --exclude-deps
    

    打包
    -------------------------------------------------------分割线-------------------------------------------------------

    $ pod trunk push XXX.podspec --allow-warnings
    [!] You need to register a session first.
    

    解决方法:

    pod trunk register 电子邮箱 '您的姓名' --description='macbook pro'
    
    

    相关文章

      网友评论

        本文标题:CocoaPods 新建 第三方+各种坑问题解决方法

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