使用theos tweak启动短信接收应用

时间:2014-01-03 18:01:41

标签: ios iphone jailbreak cydia theos

如果我收到来自特殊发件人的短信,我正在尝试启动应用。 目前我的Tweak.xm看起来像这样:

#import <SpringBoard/SpringBoard.h>
#import <UIKit/UIKit.h>
#import <ChatKit/ChatKit.h>
#import <ChatKit/CKSMSMessage.h>
#import <ChatKit/CKSMSEntity.h>
#import <ChatKit/CKSMSService.h>
#import <ChatKit/CKConversation.h>

#import <CoreTelephony/CoreTelephony.h>

%hook SMSCTServer
- (void)_ingestIncomingCTMessage:(CTMessage *)arg1
{
  %orig;
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"
        message:@"Received :D!"
        delegate:nil
        cancelButtonTitle:@";)"
        otherButtonTitles:nil];
    [alert show];
    [alert release];
}
%end
%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application {
    %orig;

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"
        message:@"Test!"
        delegate:nil
        cancelButtonTitle:@"Test"
        otherButtonTitles:nil];
    [alert show];
    [alert release];
}

%end

%hook CKSMSService

-(void)_receivedMessage:(CKSMSRecordRef)message replace:(BOOL)replace{

    NSLog(@"received message  %@", message);
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"
        message:@"Welcome to your iPhone Brandon!"
        delegate:nil
        cancelButtonTitle:@"Thanks"
        otherButtonTitles:nil];
    [alert show];
    [alert release];

        %orig;
}

%end

这是makefile:

include theos/makefiles/common.mk

TWEAK_NAME = Mytweak
Mytweak_FILES = Tweak.xm
Mytweak_FRAMEWORKS = ChatKit Foundation CoreGraphics UIKit AudioToolbox
Mytweak_PRIVATE_FRAMEWORKS = CoreTelephony
include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
        install.exec "killall -9 SpringBoard"

但我不知道如何安装Coretelephonyframework,我总是收到错误:

Tweak.xm:8:9: fatal error: 'CoreTelephony/CoreTelephony.h' file not found
import <CoreTelephony/CoreTelephony.h>

有谁知道如何将框架安装到theos中?我是jailbreakapp编码的新手。

2 个答案:

答案 0 :(得分:0)

这个answer显示了如何使用类转换来获取CoreTelephony的私有头。一旦你有标题将它们放在theos的include目录中。我认为/var/theos/include是默认值。我希望这会有所帮助。

答案 1 :(得分:0)

您的调整不需要CoreTelephony.h