Chinaunix首页 | 论坛 | 博客
  • 博客访问: 697490
  • 博文数量: 260
  • 博客积分: 7033
  • 博客等级: 少将
  • 技术积分: 2633
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-13 23:15
文章分类

全部博文(260)

文章存档

2012年(2)

2011年(41)

2010年(78)

2009年(139)

我的朋友

分类:

2010-10-07 19:38:31

今天下午和一个学习iPhone已经毕业的学生在北航柏彦大厦解决问题。

他遇到的主要问题是,想要使用Three20的TTLauncherItem类,来实现其程序中空间的晃动、删除、以及重新页面内重新排序。

参照下面的这个blog:

将Three20拷贝到自己的工程中,有一点不一样的是,我使用的  里面的Three20 库,这里面的Three 20被分解称了几个小工程。

依次将这几个小工程文件添加到自己的工程中:
1、将每个工程里面的.a在targets那个地方打个勾,表示要链接到工程中。
2、双击Targets下面的文件,在"General" -> "Direct Dependencies"中,将这几个工程文件添加进来。
3、确保这几个工程的.a文件都存在于Tagets (我的是TestThree20)下面的Link Binary With Libarary中。
4、最后一点,最要命的是,一定要在工程属性的“Other Linker Flags”中,添加”-all_load”。如果不添加这一句,会导致自定义的继承于TTViewController的类,不能访问到UIViewController(TTCatalog)类目中的方法。 我遇到的问题是,不能访问"popupViewController"方法。

原因:
Xcode在链接静态库时,不会主动去将静态库中的类目链接到当前工程代码中,会导致自定义的类访问不到.a中定义的类目。

解决方法:添加-all_load到 Other LInk Flags中。


相关资料:

IMPORTANT: 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. -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.


阅读(1150) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~