部分Xcode资料--xcode 导入另一个工程
来源:互联网 发布:js 过滤前后空格 编辑:程序博客网 时间:2024/05/16 08:18
http://www.xiaojiayi.com/2012/08/15/xcode中的子项目(译文)/
http://blog.csdn.net/liutao6982/article/details/6928486
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
http://developer.apple.com/library/mac/#qa/qa1490/_index.html
http://kongbei888.blog.163.com/blog/static/24326613201307111415481/
*/
下面属于随手笔记,还未好好整理,逻辑较混乱,仅供参考
在自己工程导入另一个工程,有点像导入静态库,只是有点像,如下图:
最好先学会静态库的生成,会很有帮助。
参考网址:http://www.xiaojiayi.com/2012/08/15/xcode中的子项目(译文)/
上面的文章有几点说的不是很到位,下面解释一下:
1.关于头文件的引入问题,上面的网址使用的方法是:
在工程的"Build Settings"里面使用搜索栏,搜索"User Header Search Paths",添入"recursive"
这种方法要求,子工程的文件夹 要放在 主工程文件夹下面,recursive就是再主工程文件夹下递归查找。
如果子工程文件 与 主工程文件夹 不是相互包含的关系,则上面的设置无效。
应该用如下方法代替:
在工程的"Build Settings"里面使用搜索栏,搜索"Header Search Paths",
添入子工程文件夹的绝对路径,就像“**子工程文件夹”。
2.对于子工程,如果在子工程文件夹下里面自己又乱建其它文件夹的话,这些自己建的文件夹下面的头文件都查找不到,要在上面的基础上,在加设置,添加 递归查找子文件夹
3.Header search paths 设置的另一种方法
设置为 $(BUILT_PRODUCTS_DIR)/include
这个路径会根据 debug 和release模式不同而不同,
同时,在子项目的
注意
1.
Other Linker Flags
build setting under the Linking collection and set its value to -ObjC
.参考连接:http://developer.apple.com/library/mac/#qa/qa1490/_index.html
the target linking against the static library must pass the
-ObjC
option to the linker. This flag causes the linker to load every object file in the library that defines an Objective-C class or categoryImportant: -ObjC
from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load
or -force_load
flags.
-all_load
forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load
is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load
option must be followed by a path to an archive, and every object file in that archive will be loaded.
2.“User Header Search Paths” 和 “Header Search Paths”
参考链接:http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
User Header Search Paths set
The “User Header Search Paths” setting defines the headers available as quoted imports (eg “#import “MyLibraryClass.h”) while the “Header Search Paths” setting defines those headers available as bracketed imports (eg “#import ). I’ve found that Xcode will only autocomplete header names in the quoted form so I always add libraries to the user header search path even though, from my project’s perspective, they might be more appropriate as system level (angle bracketed) libraries.
When using a static library which includes categories we will also have to add the “-ObjC” flag to the “Other Linker Flags” build setting. This will force the linker to load all objective-c classes and categories from the library. If the library contains only categories “-all_load” or “-force_load” may be needed as well. See Technical Q&A QA1490 for a more detailed explanation of these settings.3.注意:在ios5以及以上版本中,引入别的工程(如上)或者静态库,
并且StoryBoards中使用了【引入的外部类(外部工程或者静态库里面的类)】,
那么
Other Linker Flags 里面必须加上-ObjC,否则,会console会报错
error:Unknown class <外部的类名> in Interface Builder file.
引用:
http://developer.apple.com/library/mac/#qa/qa1490/_index.htmlImportant: For 64-bit and iPhone OS applications, there is a linker bug that prevents
-ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load
or -force_load
flags. 上面的意思是说
对于64位操作系统或者ios系统,-Objc存在一个bug,就是只包含categories ,而没有任何class的静态库,是不会被加载进来。
拮据额这个bug:使用标识符:
-all_load -force_load
- 部分Xcode资料--xcode 导入另一个工程
- xcode 导入另一个工程
- xcode导入外部工程
- Xcode工程中怎么关联另一个工程
- xcode一个工程引入另一个工程
- iOS - 将Unity导出的Xcode工程导入到另一个Xcode项目, 及常见报错的解决方法
- Xcode中一个工程嵌入到另一个工程
- iOS Xcode工程中怎么关联另一个工程
- <IOS>Xcode中一个工程如何引用另一个工程
- GPUImage框架导入到xcode工程
- Xcode工程如何将SDK包导入
- iPHone xcode导入SVN工程提示 证书问题无法导入
- xcode的工程文件怎么导入到vs2012中
- 将Cocos2d-x的VS工程导入XCode
- xcode资料整理
- xcode资料整理(沙盒)
- xcode资料大全
- xcode资料整理(沙盒)
- 行为模式之观察者模式
- 关于checkbox的监听 多选
- 3D游戏之路--第一篇—DirectX介绍
- 网址记录和开源项目
- 从零开始学习OpenGL ES之四 – 光效
- 部分Xcode资料--xcode 导入另一个工程
- Android中Intent组件详解
- bWKztRpC滞誓麓旁矣驹沤航评旨访司对拥有雷火的宇天,少年也得认真对待:“那好。我
- 从零开始学习OpenGL ES之五 – 材质
- Android Binder设计与实现 - 设计篇
- Zigbee的一些名词解释
- 在Fedora14中安装 Virtual Box Guest Additions
- 一大早接到初恋的约见电话,去还是不去
- POJ 2410 Simple Computers