The iPhone Wiki is no longer updated. Visit this article on The Apple Wiki for current information. |
CoreTelephony
CoreTelephony is the iPhone framework used for high-level cell modem interaction. It handles SMS, MMS, phone calls, etc. It is written in C, C++, and in 3.0, Objective-C portions were added.
Usage
In order to use CoreTelephony, you need to set up your build environment to link against it.
You also need a set of header files, which can be obtained by using the class-dump tool on the framework.
C functions/types
typedef struct __CTSMSMessage CTSMSMessage;
void* CTTelephonyCenterGetDefault(); void CTSMSMessageSend(void*,CTSMSMessage*); CFStringRef CTSMSMessageCopyAddress(void *, CTSMSMessage *); CFStringRef CTSMSMessageCopyText(void *, CTSMSMessage *); CTSMSMessage* CTSMSMessageCreate(void*,CFStringRef number, CFStringRef name);
Objective-C
The ObjC parts are much easier to work with because of the magic of class-dump. The only work I've done is getting an SMS message sent out. This can be accomplished in one line of code:
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:message serviceCenter:nil toAddress:number];
where message and number are NSStrings filled with the correct data.