[英]Can you programmatically send iMessage/SMS without having to press the green up-arrow in iMessage?
[英]Programmatically send iMessage using private frameworks
有誰知道是否可以使用私有框架直接發送iMessage?
我嘗試使用CTMessageCenter
的CoreTelephony
但即使我的手機可以發送iMessages,它也會發送短信。
我沒有對此進行測試,但請查看此處發布的代碼 。 如果您查看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);
}
代碼使用普通的SMS,但您可以看到以下注釋掉的代碼:
//CKMadridService *madridService = [CKMadridService sharedMadridService];
“馬德里”服務可能是發送iMessages的服務。 請在此處查看私人標題 。
SMS和iMessage私有API都在ChatKit.framework中 。
通過非越獄iPhone,絕對無法訪問iMessage CoreTelephony API
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.