• 主页
  • 系列总集
  • OpenCV
  • CMake
  • iOS
  • Java
  • 前端
所有文章 关于我

  • 主页
  • 系列总集
  • OpenCV
  • CMake
  • iOS
  • Java
  • 前端

模块化与CocoaPods(25):StaticLib和Framework两种方式引入Pods

2017-07-25

CocoaPods的原理

CocoaPods的原理就是通过脚本完成以下工作,假设存在 Playground.xcodeproj 的 Project

  1. 对所有库的头文件创建软连接,并且放入Pods目录
  2. 创建 Pods.xcodeproj 把所有的静态库打包在一起,形成一个虚拟的 lib-pods.a 的 Target
  3. 然后创建一个WorkSpace加入 Playground.xcodeproj 和 Pods.xcodeproj
  4. 配置 Playground.xcodeproj 的 Header Search Paths 引入所有Pod目录下库的头文件软连接
  5. 配置 Playground.xcodeproj 的 Linked Binary With Libraries 加入lib-pods.a
  6. 配置 Playground.xcodeproj 的 Build Phase 添加一系列脚本,类似 XX Pods XXX

使用Framework引入Pods

正常的情况下,Pods都是通过Static Lib来加载,根据CocoaPods官网可以使用指令 use_frameworks!

让Cocoapods以Framewrok的形式加入工程

1
2
3
4
use_frameworks!
platform :ios, '8.0'

........

CocoaPods 1.2.1版本的BUG

CocoPods的1.2.1版本无法将Static Lib的工程作为target,使用Pods,会报错如下,GitHub上说已修正

1
2
3
4
5
6
7
[!] Unable to find host target(s) for SharedLib. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)

赏

请问老板还招人么(/ω\)

支付宝
微信
  • iOS
  • IDE
  • Xcode
  • Compiler
  • CocoaPods
  • Tutorial

扫一扫,分享到微信

微信分享二维码
模块化与CocoaPods(26):管理多Project
模块化与Shell(24):常用的工具
© 2021 Alan Li
Hexo Theme Yilia by Litten
  • 所有文章
  • 关于我

tag:

  • iOS
  • Java
  • Collection
  • Python
  • Shell
  • CMake
  • Memory
  • JavaScript
  • Architecture
  • AnchorPoint
  • Android
  • Web
  • Annotation
  • AFNetworking
  • Window
  • ViewController
  • AutoLayout
  • Dozer
  • CoreAnimation
  • Cycle Retain
  • Block
  • UI
  • IDE
  • FrontEnd
  • CSS
  • Category
  • TableViewCell
  • Security
  • Net
  • JSP
  • Spring
  • C
  • MyBatis
  • Date
  • React
  • GCD
  • UITouch
  • Gesture
  • UIControl
  • Git
  • HTML
  • HTTPS
  • HTTP
  • Servlet
  • Server
  • DataBase
  • MySQL
  • Linux
  • Tutorial
  • Ajax
  • Type
  • JQuery
  • JSON
  • Exception
  • Parameter
  • Reflect
  • Thread
  • Sort
  • KVO
  • MKMapKit
  • Overlay
  • Maven
  • Configure
  • Tips
  • Transaction
  • Swift
  • NavigationBar
  • Nginx
  • Runtime
  • OpenCV
  • Property
  • Playground
  • Protocol
  • Redux
  • ScrollView
  • Session
  • Cookie
  • Shiro
  • Error
  • Singleton
  • RegEx
  • StackView
  • StatusBar
  • Base64
  • Socket
  • TCP
  • IP
  • TextField
  • CALayer
  • UILabel
  • View
  • Animation
  • Xcode
  • Hexo
  • Terminal
  • OC
  • Device
  • Log
  • Image
  • JUnit
  • Oval
  • Archive
  • XSS
  • Compiler
  • Aspect
  • Responder
  • Class
  • FireWall
  • RetainCount
  • Const
  • Frame
  • String
  • Symbols
  • Framework
  • CocoaPods
  • Unity
  • Message
  • Button
  • AuthorizationStatus
  • Struct
  • XCTest
  • NSNotification
  • Contact

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

我写的,大概率是错的。。。。。