首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用theos调整在短信接收时启动应用程序

使用theos调整在短信接收时启动应用程序
EN

Stack Overflow用户
提问于 2014-01-04 02:01:41
回答 2查看 1.7K关注 0票数 3

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

代码语言:javascript
复制
#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:

代码语言:javascript
复制
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框架,我总是得到这样的错误:

代码语言:javascript
复制
Tweak.xm:8:9: fatal error: 'CoreTelephony/CoreTelephony.h' file not found
import <CoreTelephony/CoreTelephony.h>

有人知道如何将框架安装到theos中吗?我对越狱应用编程完全是个新手。

EN

回答 2

Stack Overflow用户

发布于 2014-01-04 02:34:16

这个answer展示了如何使用类转储来获取CoreTelephony的私有头。获得头文件后,将它们放入theos的include目录中。我认为/var/theos/include是默认的。我希望这能帮到你。

票数 0
EN

Stack Overflow用户

发布于 2014-03-30 18:30:59

对于您的调整,CoreTelephony.h y.h是不必要的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20909914

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档