0

I just starting to learn how to write iOS tweaks. Tried to write a tweak in theos, but this part of code:

#import <UIKit/UIKit.h>

%hook SBStatusBarManager

- (void) handleStatusBarTapWithEvent: (id)arg1{

    [[UIApplication sharedApplication] launchApplicationWithIdentifier: @"com.apple.mobilesafari" suspended: NO];
    %orig;
}

%end

gives an error at compile time:

Tweak.x:7:40: error: no visible @interface for 'UIApplication' declares the selector 'launchApplicationWithIdentifier:suspended:'
    [[UIApplication sharedApplication] launchApplicationWithIdentifier: @"com.apple.mobilesafari" suspended: NO];


1 error generated.
make[3]: *** [/Users/deckard/test/.theos/obj/debug/armv7/Tweak.x.7f1f218f.o] Error 1
make[2]: *** [/Users/deckard/test/.theos/obj/debug/armv7/test.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [test.all.tweak.variables] Error 2

this method I took from http://www.iphonedevwiki.net/index.php/UIApplication. Can you tell me where is my mistake, or is this code not supposed to work? Thanks!

checkm8
  • 13
  • 1

1 Answers1

0

no visible @interface for 'UIApplication'

means that there is no UIApplication header imported.

declares the selector 'launchApplicationWithIdentifier:suspended:'

means that said header must contain a declared launchApplicationWithIdentifier:suspended: selector.

Here is a sample header file you can use, you can remove any declarations you don't need or just keep it the way it is. Copy it to your tweak directory and then import it:

#import "UIApplication2.h"

Krzysio
  • 11
  • 3