我想开发一个像biteSMS这样的应用程序(用于越狱的iPhone)。我试图编译一个开源应用程序iPhone-Delivery-Report但无法编译它。有人知道与越狱iPhone发送的核心电话短信相关的任何内容吗?示例代码非常有用。
更新
感谢约书亚儿子的大力帮助。
以下是警告的屏幕截图。
答案 0 :(得分:2)
试试这段代码;
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:@"Your Message here"
serviceCenter:nil
toAddress:@"Receiver's Phone Number here"];
答案 1 :(得分:2)
我不是说CTMessageCenter
实施不起作用,但这是另一种选择,taken from the code found here:
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);
}
要使用CKSMSService
课程,请链接项目中的私有 ChatKit.framework,#import
CKSMSService.h header。编译器可能会告诉您需要来自ChatKit的其他一些标题,您可以在同一个地方(我的链接)找到它们。只需将这些头文件复制到应用程序的源目录中即可
#import "CKSMSService.h"
在使用它们之前。