2012-01-19 9 views
6

Qualcuno sa se è possibile inviare un iMessage direttamente utilizzando un framework privato?Invio di iMessage tramite framework privati ​​

Ho provato a utilizzare CTMessageCenter da CoreTelephony ma invierà un SMS anche se il mio telefono può inviare iMessage.

+0

Aggiunto tag jailbreak, sembra adattarsi qui. –

risposta

2

non ho ancora testato questo, ma guarda at the code posted here. Se si guarda a httpResponseForMethod:URI:, si vede dove lui/lei invia un messaggio (sembra essere hardcode per sostenere iOS 5 o 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); 

} 

Il codice utilizza normale SMS, ma si può vedere la seguente codice commentato:

//CKMadridService *madridService = [CKMadridService sharedMadridService]; 

Il servizio "Madrid" è probabilmente quello che può inviare iMessage. See the private header here.

Entrambe le API private SMS e iMessage sono nello ChatKit.framework.

+0

funziona solo in jail break – iosMentalist

+0

@Enkidu, se guardi i tag delle domande, vedrai che si tratta di una domanda di jailbreak. – Nate

+0

non sto chiedendo che sto informando. Ho aggiunto il tag jailbreak :) – iosMentalist

-4

Attraverso un iPhone non jailbreak non c'è assolutamente alcun accesso alle API di iMessage CoreTelephony

+0

ma che dire di un telefono jailbroken? –

+0

Ci scusiamo per il fatto che dovrai utilizzare Google. Non ho esperienza con i telefoni jailbroken. – aldridmc

Problemi correlati