Programmatically send iMessage using private frameworks

▼魔方 西西 提交于 2019-12-31 16:54:04

问题


Does anyone know if it's possible to directly send an iMessage using a private framework?

I tried using CTMessageCenter from CoreTelephony but it'll send an SMS even though my phone can send iMessages.


回答1:


I haven't tested this, but look at the code posted here. If you look at httpResponseForMethod:URI:, you see where he/she sends a message (appears to be hardcode to support iOS 5 or 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);

}

The code uses normal SMS, but you can see the following commented out code:

//CKMadridService *madridService = [CKMadridService sharedMadridService];

The "Madrid" service is probably what can send iMessages. See the private header here.

Both SMS and iMessage private APIs are in the ChatKit.framework.




回答2:


Through a non jailbreak iPhone there is absolutely no access to the iMessage CoreTelephony API



来源:https://stackoverflow.com/questions/8932094/programmatically-send-imessage-using-private-frameworks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!