Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
CKMadridService - iPhone Development Wiki


From iPhone Development Wiki

CKMadridService is Apple's codename for the service used to send iMessages. It is available only in iOS 5 (see ChatKit.framework).

Creating and sending an iMessage with CKMadridService

//Compose a message
CKMessageStandaloneComposition *composition = [CKMessageStandaloneComposition newCompositionForText:@"Test Message"];

//Get a reference to the shared conversation list
CKConversationList *conversationList = [CKConversationList sharedConversationList];

//Get a reference to the shared Madrid Service
CKMadridService *madridService = [CKMadridService sharedMadridService];

NSString *messageRecipient = @"+1234567890"; // This is the phone number or email of the message recipient

//Make a Conversation
CKSubConversation *conversation = [conversationList conversationForGroupID:messageRecipient create:YES service:madridService];

//Create a message
CKMadridMessage *message = [madridService newMessageWithComposition:composition forConversation:conversation];

[madridService sendMessage:message];

[message release];
[composition release];
  • Note that you are responsible for releasing the message and the composition, but not the conversation.

External links