I've assembled the following code snippet from samples and books to try and send my first SMS.
However when I run the following it create a page fault exception. Does anyone know why this may be the case?
I do end up with a well formed message in my draft message folder so at least I know the first half is working correctly!
// Address buffer
// Create send as object
CSendAs *sendAs = CSendAs::NewL(*this);
// Use SMS and the first service
sendAs->SetMtmL( KUidMsgTypeSMS );
// Create the message
// Add the recipient address
sendAs->AddRecipientL( address );
// Set the body
sendAs->ClientMtm().Body().InsertL(0, KBody );
// Check message validity
// Send the message (this puts it in the drafts folder)
// Get the client mtm
CBaseMtm &clientMtm = sendAs->ClientMtm();
// Get the session of the client
CMsvSession &session = clientMtm.Session();
// Access registry
CMtmUiRegistry *mtmUiRegistry = CMtmUiRegistry::NewL( session, 30000000 );
// Create base mtm ui
CBaseMtmUi *baseMtmUi = mtmUiRegistry->NewMtmUiL( clientMtm );
// Find the message entry ID
TMsvId entryID = clientMtm.Entry().EntryId();
// Create a selection object
CMsvEntrySelection *selection = new (ELeave) CMsvEntrySelection();
// Add the message ID to the selection
// Get the service ID
TMsvId serviceID = clientMtm.Entry().Entry().iServiceId;
// Switch client mtm to this service
// Copy the selection to the service !!!! PAGE FAULT EXCEPTION OCCURS IN THESE LINES !!!!
baseMtmUi->CopyToL(*selection, status );
// Wait for the copying to finish
User::WaitForRequest( status );
// Delete the base mtm ui
// Delete the selection
// Delete send as
I'm grateful for any ideas or help! When looking at the assembler it looks like it is taking the address from the jump table for the "CopyToL" function and that address is bad.