gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 04:04:20 28 4
gpt4 key购买 nike

有谁知道是否可以使用私有(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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com