如何阻止iPhone越狱+代码中传入的短信 [英] How to block incoming SMS in iPhone jailbreak + code

查看:190
本文介绍了如何阻止iPhone越狱+代码中传入的短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在问这个问题之前搜索了SO,没有满足我需求的答案。

I searched SO before asking this question , there is no answers satisfying my needs.

所以这是我的要求,

我有这段代码用于检测传入的SMS,但它没有说明如何转储这些消息。我已成功阻止来电,但对于消息,我不知道如何做到这一点。这里的任何帮助将非常感谢。

I have this piece of code for detecting the incoming SMS , but it does not say how to dump these messages. I have successfully blocked the incoming calls but for messages i am not sure how to do this. any help here would be very much appreciated.

我可以使用任何私有API。

I am ok in using any private APIs.

if ([notifyname isEqualToString:@"kCTSMSMessageReceivedNotification"])
{
    if ([[(NSDictionary *)userInfo allKeys]
         containsObject:@"kCTSMSMessage"]) // SMS Message
    {
        CTSMSMessage *message = (CTSMSMessage *)
        [(NSDictionary *)userInfo objectForKey:@"kCTSMSMessage"];
        NSString *address = CTSMSMessageCopyAddress(NULL, message);
        NSString *text = CTSMSMessageCopyText(NULL, message);
        //NSArray *lines = [text componentsSeparatedByString:@"\n"];
        printf(" %s %s\n", [address UTF8String],[text UTF8String]);
        //printf(" %s\n", [text cString]);
        fflush(stdout);

    }
}
else if ([notifyname isEqualToString:@"kCTMessageReceivedNotification"])//received SMS
{
    /*
     kCTMessageIdKey = "-2147483636″;
     kCTMessageTypeKey = 1;
     */

    NSDictionary *info = (NSDictionary *)userInfo;
    CFNumberRef msgID = (CFNumberRef)[info objectForKey:@"kCTMessageIdKey"];
    int result;
    CFNumberGetValue((CFNumberRef)msgID, kCFNumberSInt32Type, &result); 
    /*
     Class CTMessageCenter = NSClassFromString(@"CTMessageCenter");
     id mc = [CTMessageCenter sharedMessageCenter];
     id incMsg = [mc incomingMessageWithId: result];

     int msgType = (int)[incMsg messageType];

     if (msgType == 1) //experimentally detected number
     {
     id phonenumber = [incMsg sender];

     NSString *senderNumber = (NSString *)[phonenumber canonicalFormat];
     id incMsgPart = [[incMsg items] objectAtIndex:0];
     NSData *smsData = [incMsgPart data];
     NSString *smsText = [[NSString alloc] initWithData:smsData encoding:NSUTF8StringEncoding];
     }
     */
}

谢谢
Naveen

Thanks Naveen

推荐答案

你的问题不够明确。您是否希望将它们完全删除,以便它们甚至不在消息应用程序(和数据库)中,或者您只是希望SpringBoard不通知用户传入的消息?

You're question isn't clear enough. Do you want them to be dropped completely so they won't even be in the Message App (and the database) or do you just want SpringBoard to not notify the user of an incoming message?

对于第一个,您必须挂钩实际发送您在代码片段中收听的通知的进程。我很确定你不得不修补imagent(/System/Library/PrivateFrameworks/IMCore.framework/imagent.app/imagent)。

For the first one you will have to hook the process which actually sends out that notification which you are listening to in your code sniplet. I'm pretty sure that you'll have to tinker with imagent (/System/Library/PrivateFrameworks/IMCore.framework/imagent.app/imagent).

第二个你必须在SpringBoard中玩。由于iOS 5.0 BulletinBoard正在处理对用户的通知,因此您可以在那里阻止它。 (你可能想看一下这是一个BulletinBoard插件的SMSBBPlugin)。

For the second one you'll have to play around in SpringBoard. Since iOS 5.0 BulletinBoard is handling the notifications to the user, so you could block it there. (You probably wanna check out the SMSBBPlugin which is a BulletinBoard plugin).

或者只是启动你选择的反汇编程序,看看像biteSMS这样的调整是怎么做的;)

Or just fire up your disassembler of choice and see how tweaks like biteSMS are doing it ;)

请记住,越狱调整开发有时需要大量的逆转和修补,大多数人会将自己的调查结果留给自己。

Keep in mind that jailbreak tweak development sometimes requires a lot of reversing and tinkering and most people will keep huge parts of their findings to themselves.

这篇关于如何阻止iPhone越狱+代码中传入的短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆