Xcode framework 的编译及测试

栏目: IOS · 发布时间: 7年前

内容简介:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kmyhy/article/details/82991408

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kmyhy/article/details/82991408

创建 Framework 工程

  1. 新建 Cocoa Touch Framework
  2. 编写 Podfile
  3. pod install 安装第三方依赖
  4. 打开 .xcworkspace
  5. 添加要公开的头文件到 Build Phases / Headers / Public 下
  6. command+B,编译 framework

创建测试工程

  1. 在静态库的工作空间中,新建一个 Target,选择 Single view applictation,作为测试工程
  2. 选择这个 Target,在 Build Phases 中,在 Target Dependencies 下添加已经编译好的 framework 作为依赖
  3. 在测试工程的 General / Linked Frameworks and Librarys 中添加这个 framework
  4. 在测试工程中编写调用代码,进行调试

常见错误:

  • dyld: Library not loaded: @rpath……Reason: image not found

将 framework 改为静态库,mach-o type 设为 Static Library,然后重新编译 framework

  • 编译错误:找不到第三方 cocoapods 库的头文件

    修改 Podfile 文件,在测试工程的 target 下增加必要的 pod。

如果 framework 和测试工程的 pod 相同,也可以用 .each 循环:

targets = ['YLYIndoorNavigation','YLYIndoorNavigationDemo']
targets.each do |t|
    
    target t do
        pod 'AFNetworking'
        pod 'FDFullscreenPopGesture', '~> 1.1'
		... ...
    end

end

然后 pod install。

  • 编译出错:Undefined symbols for architecture i386:

    “___gxx_personality_v0”, referenced from:

    在工程中添加添加 libstdc++.dylib 即可。

  • Archive 时报错:ld: library not found for -lAFNetworking

    在 Link Binary with Libraries 中,添加相关 pod 库(比如libAFNetworking.a 等)。

  • Archive 出错:bitcode bundle could not be generated because ‘xxxx’ was built without full bitcode.

    将 Target 的 Enable Bitcode 设置为 NO。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

日赚500元

日赚500元

董俊峰 / 2008-5 / 20.00元

《日赚500元:揭开网络赚钱的秘密》是一本大学生网络创业必看的图书,一本想在网络上创业的人必看的图书。懂懂团队第一个操作Google FireFox下载项目,第一个操作“域名停靠”项目。第一个操作Google账号推介项目。首次提出“网赚”这个概念,并创造性地将“网赚”的过程分为3个阶段。《日赚500元:揭开网络赚钱的秘密》揭开了网络上一些行为的本质。一起来看看 《日赚500元》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具