ios - 使用私有(private)框架以编程方式发送 iMessage

标签 ios iphone sms jailbreak iphone-privateapi

有谁知道是否可以使用私有(private)框架直接发送 iMessage?

我尝试使用 CoreTelephony 中的 CTMessageCenter,但它会发送短信,即使我的手机可以发送 iMessage。

最佳答案

我还没有测试过这个,但是看看at the code posted here .如果您查看 httpResponseForMethod:URI:,您会看到他/她发送消息的位置(似乎是支持 iOS 5 或 iOS 4 的硬编码):

CKSMSService *smsService = [CKSMSService sharedSMSService];

//id ct = CTTelephonyCenterGetDefault();
CKConversationList *conversationList = nil;

NSString *value =[[UIDevice currentDevice] systemVersion];          
if([value hasPrefix:@"5"])
{
    //CKMadridService *madridService = [CKMadridService sharedMadridService];
    //NSString *foo = [madridService _temporaryFileURLforGUID:@"A5F70DCD-F145-4D02-B308-B7EA6C248BB2"];

    NSLog(@"Sending SMS");
    conversationList = [CKConversationList sharedConversationList];
    CKSMSEntity *ckEntity = [smsService copyEntityForAddressString:Phone];
    CKConversation *conversation = [conversationList conversationForRecipients:[NSArray arrayWithObject:ckEntity] create:TRUE service:smsService];
    NSString *groupID = [conversation groupID];           
    CKSMSMessage *ckMsg = [smsService _newSMSMessageWithText:msg forConversation:conversation];
    [smsService sendMessage:ckMsg];
    [ckMsg release];     
} else {
    //4.0
    id ct = CTTelephonyCenterGetDefault();
    void* address = CKSMSAddressCreateWithString(pid); 

    int group = [grp intValue];         

    if (group <= 0) {
        group = CKSMSRecordCreateGroupWithMembers([NSArray arrayWithObject:address]);       
    }

    void *msg_to_send = _CKSMSRecordCreateWithGroupAndAssociation(NULL, address, msg, group, 0);    
    CKSMSRecordSend(ct, msg_to_send);

}

代码使用的是普通短信,但是可以看到下面注释掉的代码:

//CKMadridService *madridService = [CKMadridService sharedMadridService];

“马德里”服务可能是可以发送 iMessages 的服务。 See the private header here .

SMS 和 iMessage 私有(private) API 都在 ChatKit.framework 中。

关于ios - 使用私有(private)框架以编程方式发送 iMessage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8932094/

相关文章:

java - 如何给自己发送短信

android - 如何将数据短信发送到安装在不同手机上的我的应用程序,而不会出现在收件箱中

iphone - 将自定义 UINavigationBar 与 initAsRootViewController 一起使用 :

iphone - NSGenericException',原因 : 'Push segues can only be used when the source controller is managed by an instance of UINavigationController

iphone - UITableView注册Nib :forCellReuseIdentifier:

iOS 11 ARKit : Drag Object in 3D View

android - 如何在 Android 中以编程方式从设备读取短信?

ios - 在 Xcode 4 中导航代码的最快方法

iphone - 崩溃报告中是否提供 iOS 设备 UDID?

ios - ssziarchive 错误