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?
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];