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

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

模块化与Framework(15):特殊的Unique Framework

2017-07-15

Umbrella OR Unique

根据上文描述,在Mac OS中有Umbrella Framework的概念,但是在iOS中这个概念不再被苹果提及

本文将整理如何实现同Umbrella Framework一样效果的Unique Framework来完成一些特殊的需求

Unique Framework的关键点

  1. 根据文章Framework的多版本和Umbrella介绍,目前StackOverflow上的所有答案均为错误
  2. 制作Unique Framework的所有代码必须本人可控,不能依赖第三方库

Unique Framework的拆解

根据上文介绍,Framework一共可以分为三个部分

模块 作用 Unique化方案
头文件系统 根据modulemap进行头文件管理 通过Disk Path 和 Search Path引入,并加入Umbrella
Mach-O 可执行文件 通过设置依赖的Framework为Static Mach-O,让其加入Unique Mach-O
资源文件 资源压缩包 通过Disk Path引入,伪装成Bundle

我们后续文章将会对如下架构进行Unique Framework教学

image01:image01

Unique Framework 无法避免的重复类(按照上述方法应该不会出现)

直接把需要暴露的类拷贝到 Unique Framework中,直接使用,很多人会疑问不会出现 Duplicated Symbols 的错误么? 答案是不会,仅仅会在运行时丢出一个错误

1
2
3
4
5
Class PLBuildVersio is implemented in both  
.........
.........
One of the two will be used. Which one is undefined.

这种处理方法,在苹果的 PhotoLibraryServices.framework 和 AssetsLibraryServices.framework 中 PLBuildVersio 就使用到了

虽然比较粗暴,但是也不会有任何问题,唯一需要保证的是,两处的实现一定要一致 具体讨论可以查看 Class PLBuildVersion is implemented in both frameworks

赏

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

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

扫一扫,分享到微信

微信分享二维码
模块化与Framework(16):Unique Framework制作步骤
模块化与Framework(14):静态编译Static Framework
© 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
    

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