cocoaPods管理自己的静态库供其它人下载使用(直接使用上一篇用cocoaPod打包的静态库)
(1) 创建github仓库


(2) 下载仓库到本地


(3) 将打包好的framework放到项目中

(4) 终端提交到github上

git add .
git commit -m “install”
git push origin master

(5) 打标签, 并提交到github上

git tag 1.0.
git push origin 1.0.

二 (1) 在工程根目录初始化一个Podspec文件, 最好与项目同名

(2) 配置文件

#
# Be sure to run `pod spec lint XCLogLib.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
# Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
# s.name = "XCLogLib"
s.version = "1.0.0"
s.summary = " XCLogLib test demo" # This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
A Test XCLogLib Demo. where you can put your description.
DESC s.homepage = "https://github.com/xiaocai33/XCLogLib"
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
# #s.license = "MIT (example)"
s.license = { :type => "MIT"} # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
# s.author = { "Cai Tengyuan" => "tycai1@baidu.com" }
# Or just: s.author = "Cai Tengyuan" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
# # s.platform = :ios
s.platform = :ios, "8.0" # When using multiple platforms
# s.ios.deployment_target = "5.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0" # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
# s.source = { :git => "https://github.com/xiaocai33/XCLogLib.git", :tag => "#{s.version}" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
# s.source_files = "XCLogLib", "XCLogLib/**/*.{h}"
#s.exclude_files = "Classes/Exclude"
s.vendored_libraries = "*/libXCLogStaticDemo.a"
# framework is
#s.vendored_frameworks = '*/XCLogStaticDemo.framework' # s.public_header_files = "Classes/**/*.h" # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
# # s.resource = "icon.png"
# s.resources = "Resources/*.png" # s.preserve_paths = "FilesToSave", "MoreFilesToSave" # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
# # s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework" # s.library = "iconv"
# s.libraries = "iconv", "xml2" # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works. s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4" end

(3) 创建账号(如果已经创建过, 省略)

pod trunk register 邮箱 联系人 --description="描述" --verbose

创建成功会收到邮件,进邮箱验证

pod trunk me 可查看trunk信息

(4) trunk push之前要先验证

pod spec lint XCLogLib.podspec

出现 XCLogLib.podspec passed validation表示通过了
如果只是waring通过

pod lib lint --allow-warnings #强制忽略

如何 想看错误详情

pod spec lint XCLogLib.podspec --verbose

如果有错, 看下配置文件哪里错了.


(5) pod trunk push 这个有点耐心, 需要会时间


(6) 成功后pod search XCLogLib

如果搜索不到, 请看上篇博客介绍.

(7) 在其它项目的 Podfile 中引用:

platform :ios, ‘8.0' 注意版本要大于静态库支持的最低版本
pod ‘XCLogLib'
或者 pod ‘XCLogLib’, '~> 1.0.0’

这样就可以在demo中引用头文件

#import “XCLog.h”

然后调用静态库的方法了.

如果是framework的框架, 则需要将配置文件的

s.vendored_libraries = “*/libXCLogStaticDemo.a"

改为 (注意路径)

s.vendored_frameworks = ‘*/XCLogStaticDemo.framework'

即可, 这里不再演示

三 xcode项目支持pod
终端:

cd path #到项目目录
pod init fileName.Podfile #创建 Podfile 文件

打开文件在其中添加需要依赖的库
例:

pod ‘XCLogLib’

例子:

cocoaPods打包的静态库的更多相关文章

  1. iOS中打包.a静态库

    1.新建.a静态库工程 需要选择Static Library静态库工程模板新建工程,如下图: 新建静态库工程 实现需要打包的类,如下图: 实现需要打包的类 2.设置需要暴露的头文件 添加Headers ...

  2. iOS - .a静态库的打包(包括打包的文件中用到了一些别人的三方库和分类的处理)

    一.概念篇 什么是库? 库是程序代码的集合,是共享程序代码的一种方式 根据源代码的公开情况,库可以分为2种类型 开源库 公开源代码,能看到具体实现 比如SDWebImage.AFNetworking ...

  3. iOS开发——打包静态库与Framework

    最近老是需要做接口给别的客户,就顺便把打包的过程也写一下吧! 一.静态库 静态图里面只能是纯文件,里面不能再有第三方打包的静态库,也就是说,静态库不能打包静态库.这个用的比较多,一般自己公司写出来的东 ...

  4. iOS打包静态库(完整篇)

    1. 什么是库? 所谓库就是程序代码的集合,是共享程序代码的一种方式. 2. 库的分类 根据程序代码的开源情况,库可以分为两类 开源库源代码是公开的,你可以看到具体实现.比如GitHub上比较出名的第 ...

  5. (一〇二)静态库(.a)的打包

    库是代码的集合,根据代码公开程度,分为开源库和闭源库. 其中闭源库主要包括静态库和动态库,是经过编译的二进制文件,看不到具体实现. 静态库的拓展名是.a或者.framework,动态库则是.dylib ...

  6. 李洪强iOS开发之静态库的打包一

    李洪强iOS开发之静态库的打包一 //静态库一般做一下几种事情 //1 工具类 算法逻辑 新建工具类LHQTools 定义类方法 + (NSInteger)sumWithNum1: (NSIntege ...

  7. iOS静态库.a总结(2017.1.24增加脚本打包方法)

    修改于:2017.1.24 1.什么是库? 库是程序代码的集合,是共享程序代码的一种方式 2.根据源代码的公开情况,库可以分为2种类型 a.开源库 公开源代码,能看到具体实现 ,比如SDWebImag ...

  8. ios打包静态库

    1. 什么是库? 所谓库就是程序代码的集合,是共享程序代码的一种方式. 2. 库的分类 根据程序代码的开源情况,库可以分为两类 开源库源代码是公开的,你可以看到具体实现.比如GitHub上比较出名的第 ...

  9. 【转】iOS动态库和静态库的简要介绍

    静态库与动态库的区别 首先来看什么是库,库(Library)说白了就是一段编译好的二进制代码,加上头文件就可以供别人使用. 什么时候我们会用到库呢?一种情况是某些代码需要给别人使用,但是我们不希望别人 ...

随机推荐

  1. Python实战之SocketServer模块

    文章出处:http://www.cnblogs.com/wupeiqi/articles/5040823.html SocketServer内部使用 IO多路复用 以及 "多线程" ...

  2. ubuntu访问文件服务器

    随便打开一个文件夹,按ctrl+L 输入 smb://172.29.17.1 然后输入用户名和密码即可

  3. Java面向对象 集合(中)

     Java面向对象 集合(中) 知识概要:                   (1)泛型的体系概念 (2)泛型的特点 (3)自定义泛型类 泛型的体系概念           泛型:JDK1.5版 ...

  4. asp.net mvc5中使用缓存依赖SqlCacheDependency

    缓存是用来提高应用性能,降低服务器压力.适用于数据不易变,数据易通用的情景, 对于动态查询数据,例如数据分析,最好放弃使用缓存.使用缓存最麻烦的就是保持源数据和缓存的中的数据一致. 缓存(Cache) ...

  5. Jquery+Ajax限制查询间隔

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Jquery20150305.a ...

  6. wampserver里面出现403错误的问题解决方法

    今天再装wampserver的时候,不能进入localhost和phpmyadmin,提示403错误,我自己是win10系统,已通过以下方法解决了: 1.第一个问题,就是wampserver没有切换到 ...

  7. J2EE走向成功路-02-Struts2 配置(Maven)

    在上一篇中,介绍了使用jar包搭建Struts2框架,这一篇中来介绍一下在Maven环境下搭建Struts2框架,主要为配置Maven. 1.下载Maven,官网:http://maven.apach ...

  8. kubeernetes节点资源限制

    实际应用中发现,部分节点性能不足,某些较大的服务如果跑在这些机器上.会很快消耗该机器的内存和cpu资源,如果用uptime看一下的就会发现负载特别高(合理的范围这个值应该等于cpu个数),高到一定值就 ...

  9. Object类—复写equals方法,hashCode方法,toString方法

    Object:所有类的根类. Object是不断抽取而来,具备着所有对象都具备的共性内容. class Person extends Object { private int age; Person( ...

  10. MSDN-9月杂志推荐

    序言:MSDN Magazine频道每月都会推出杂志,提供给广大开发者免费阅读,文章的作者往往都是国内外技术大牛.而且翻译良好(机器翻译除外)排班工整,是技术进阶的绝美助力! 本系列文章会关注MSDN ...