2

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

2 Answers 2

6

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];
2
  • I know that this is a very old question, but I'd have the possible use of the %c Logos directive documented here.
    – Matoe
    Aug 5, 2012 at 22:24
  • This has literaly opend my eyes to the world of tweaking the lockascreen :D Nov 20, 2012 at 1:21
1

You can also use:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.