尝试编译 MobileSubstrate 插件 - 未定义的符号

发布于 2024-08-30 06:18:53 字数 1121 浏览 5 评论 0原文

我通过本教程创建了一个 MobileSubstrate 插件。我可以毫无错误地编译示例挂钩

但是,一旦我添加

#import <SpringBoard/SBAwayController.h>

ExampleHookProtocol.h

SBAwayController *awayController = [SBAwayController sharedAwayController];

ExampleHookLibrary.mm (作为 __$ExampleHook_AppIcon_Launch 函数的第一行),我就得到了尝试 make 时出现以下错误消息(由后一个更改触发):

Undefined symbols:
  "_OBJC_CLASS_$_SBAwayController", referenced from:
    __objc_classrefs__DATA@0 in ExampleHookLibrary.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ExampleHook.dylib] Error 1.

SBAwayController 的头文件位于 /var/toolchain/sys30/usr/include/SpringBoard ,就像ExampleHook 使用的SBApplicationIcon.h 一样。

我正在我的 iPod touch 2G 上进行编译。

谁能帮助我吗?

预先感谢,

埃里克

I went through this tutorial to create a MobileSubstrate addon. I could compile the example hook without errors.

But as soon as I add

#import <SpringBoard/SBAwayController.h>

in ExampleHookProtocol.h and

SBAwayController *awayController = [SBAwayController sharedAwayController];

in ExampleHookLibrary.mm (as the first line of the __$ExampleHook_AppIcon_Launch function) I get the following error message when attempting to make (triggered by the latter change):

Undefined symbols:
  "_OBJC_CLASS_$_SBAwayController", referenced from:
    __objc_classrefs__DATA@0 in ExampleHookLibrary.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ExampleHook.dylib] Error 1.

The header file for SBAwayController is located in /var/toolchain/sys30/usr/include/SpringBoard, just like SBApplicationIcon.h, which is used by the ExampleHook.

I'm compiling on my iPod touch 2G.

Can anyone help me?

Thanks in advance,

Eric

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

童话 2024-09-06 06:18:53

由于编译时没有任何可链接的内容,因此需要在运行时获取该类,因此添加

Class $SBAwayController = objc_getClass("SBAwayController");

初始化程序,并更改

SBAwayController *awayController = [SBAwayController sharedAwayController];

SBAwayController *awayController = [$SBAwayController sharedAwayController];

Since there is nothing to link to when you compile, you need to get the class at runtime, so add

Class $SBAwayController = objc_getClass("SBAwayController");

in the initializer, and change

SBAwayController *awayController = [SBAwayController sharedAwayController];

to

SBAwayController *awayController = [$SBAwayController sharedAwayController];
疑心病 2024-09-06 06:18:53

您还可以使用:

SBAwayController *awayController = [objc_getClass("SBAwayController") sharedAwayController];

You can also use:

SBAwayController *awayController = [objc_getClass("SBAwayController") sharedAwayController];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文