【发布时间】:2014-10-05 11:41:13
【问题描述】:
目标
我正在尝试构建最简单的 Theos 应用程序,它的作用类似于 HTTP 服务器。
我对使用哪些库没有具体偏好,但这次我尽量使用 HTTPKit。我将感谢任何有关如何构建此类应用程序的 cmets 和/或链接。
两句话问问题
在 Theos 应用项目中使用 HTTPKit 失败。使用任何 HTTPKit 类时获取“未定义符号”。
个人想法
我确定“未定义符号”错误是由错误链接引起的。而且我几乎可以肯定它与dependencies folder 有关系,因为我不知道把它放在哪里以及如何链接它。
并非完全需要使用HTTPKit,但我在尝试在 Theos 应用程序中实现 CocoaHTTPServer 时遇到了完全相同的问题。
如果我在安装 Theos 和制作应用程序时出错,我也会感谢任何 cmets。
我如何安装和配置 Theos
- 使用 following guide 安装了 Theos
-
从 headers repository 之一下载所有内容到
$(THEOS)/包括
-
从 here 下载(另外)IOSurfaceAPI.h 到
$(THEOS)/include/IOSurface
制作一个简单的项目
1.使用网卡创建一个Theos应用
cd ~
$THEOS/bin/nic.pl
NIC 2.0 - New Instance Creator
------------------------------
[1.] iphone/application
[2.] iphone/library
[3.] iphone/preference_bundle
[4.] iphone/tool
[5.] iphone/tweak
Choose a Template (required): 1
Project Name (required): name
Package Name [com.yourcompany.name]:
Author/Maintainer Name [***]:
Instantiating iphone/application in name/...
Done.
2.将整个仓库HTTPKit放到新建的文件夹中
~/name/HTTPSources
3.添加以下行
name_FILES += $(foreach ext, c cpp m mm x xm xi xmi, $(wildcard HTTPSources/*.$(ext)))
进入 Makefile,所以它看起来像 this
4.将here中的所有文件放入新创建的
$THEOS/include/HTTPKit
5.现在 $(THEOS) 文件夹看起来像 this
6.现在调用 make 不会导致致命错误(除了 ldid 命令,我猜这不是至关重要的)导致
~/name/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application name...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling nameApplication.mm...
Compiling RootViewController.mm...
Linking application name...
Stripping name...
Signing name...
/bin/sh: ldid: command not found
尝试使用 HTTPKit,出现错误
1.添加了HTTPKit导入和example
中的几行简单代码HTTPServer * serv = [[HTTPServer alloc] init];
[serv handleGET:@"/hello/*"
with:^(HTTPConnection *connection, NSString *name) {
return [NSString stringWithFormat:@"Hello %@!", name];
}];
进入 ~/name/main.m 所以它看起来像 this
2.现在调用make会导致“Undefined symbols for architecture armv7”错误
~/name/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application name...
Copying resource directories into the application wrapper...
Compiling main.m...
Linking application name...
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_HTTPServer", referenced from:
objc-class-ref in main.m.f3071598.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/name.app/name.ba964c90.unsigned] Error 1
make[1]: *** [internal-application-all_] Error 2
make: *** [name.all.application.variables] Error 2
其他信息
【问题讨论】:
-
你搞定了吗?我正在尝试做同样的事情。
标签: objective-c ios7 jailbreak theos