ios,pod 更新版本和降级版本,OSX 10.10+,打包pod,全教程

淺唱寂寞╮ 提交于 2019-12-11 14:33:24

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

####cocoaPods详细教程 参考标哥的技术博客等,本文原创,转载请注明出处,打包pod请参考另外一篇博客

###以下列举更新和卸载时候的问题,会在容易出错的地方注明请大家注意 //更新pod

sudo gem update --system // 先更新gem,国内需要切换源
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem sources -l
  CURRENT SOURCES
  http://ruby.taobao.org/
sudo gem install cocoapods // 安装cocoapods
pod setup

//不绕过osx10.11的安全设置正常更新

sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
gem --version
pod --version

//创建一个Podfile

touch Podfile
vi Podfile

/* ###降级pod版本

which pod
sudo rm -rf <path>
//sudo rm -rf /usr/local/bin/pod
gem list

sudo gem uninstall claide -v 1.0.0

sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-deintegrate
sudo gem uninstall cocoapods-packager
sudo gem uninstall cocoapods-downloader
sudo gem uninstall cocoapods-plugins
sudo gem uninstall cocoapods-search
sudo gem uninstall cocoapods-stats
sudo gem uninstall cocoapods-trunk
sudo gem uninstall cocoapods-try

sudo gem install -n /usr/local/bin cocoapods -v 0.39.0

pod --version

####cocoaPods 1.0+ podfile写法

platform :ios, '7.1'
use_frameworks!

target 'iOS' do
    pod 'AFNetworking', '~> 2.6.3'
    pod 'SDWebImage', '~>3.8.1'
    pod 'SDCycleScrollView','~> 1.65'
end

//安装打包类库的工具
sudo gem install cocoapods-packager

###创建pod和打包静态库 ####会在另外一片博客中介绍,一下是基本命令介绍

####创建一个pod开源库

cd SXHelper/
git clone https://git.oschina.net/loveNancyForever/Demo.git
git commit -am 'init'
git add .
git commit -m 'init'
pod spec create SXHelper
git add .
git tag 0.0.1
git push --tags
git push origin master
pod lib lint SXHelper.podspec --allow-warnings
//git push origin :refs/tags/0.0.1
pod trunk push SXHelper.podspec --allow-warnings
//pod trunk register bieshixuan@163.com 'xiaoR' --description='helper'
pod trunk push SXHelper.podspec --allow-warnings

####创建一个git 私有库

创建好podspec文件,并将整个工程推送到git服务器这边。 引入私有库的方式:

pod 'DemoLib',:git=>"http://xxxxx.git"(替换为真实的git地址)

####打包一个静态库 http://www.cnblogs.com/brycezhang/p/4117180.html

####7.28号添加,.DS_Store冲突 原因是没有忽略.xxx文件

vi ~/.gitignore_global

Adding Rules for ignoring files like:

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

Now, add this file to your global git config:

git config --global core.excludesfile ~/.gitignore_global

####如有问题,欢迎留言为你解答

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!