Problem composing a SMS message

Hi,

I’m trying to create an app on iOS that composes a text / SMS message for personal use.

I’ve run the ComposeEmailSMS sample code in the simulator on both Windows 7 and a Hachintosh (OS X Mavericks), but I keep getting the ‘SMS not supported/setup on this device’ message box and ‘Mail not supported/setup on this device’ message box.

However when I build ComposeEmailSMS and run in Xcode, the e-mail works but not the SMS.

So I used a simple bit of code below:

if ( native.canShowPopup( “sms” ) ) then
    local options = {
        to = { “1234567890”, “9876543210” },
        body = “I scored over 9000!!! Can you do better?”
    }
    local result = native.showPopup( “sms”, options )

    print( “SMS IS supported/setup on this device” )
    native.showAlert( “Great!”, "SMS is supported/setup on this device. Result is "…tostring(result), { “OK” } )

else
    print( “SMS Not supported/setup on this device” )
    native.showAlert( “Alert!”, “SMS not supported/setup on this device.”, { “OK” } )
end

Again this doesn’t work in either the Windows or Mac simulators. In the Xcode iOS simulator, I get the message ‘SMS is supported/setup on this device. Result is false’. This must mean that SMS messaging can be invoked in the Xcode iOS simulator, so the problem must be with the line of code:

local result = native.showPopup( “sms”, options )

I’ve also tried:

native.showPopup( “sms” )

but this doesn’t invoke SMS messaging either.

I haven’t purchased a developer licence from Apple yet as I want to make sure that I can get this working before paying out $99 to test on a real iPhone.

If anyone had any suggestions how to fix this problem, that’d be great.

Thanks

Just a couple of things…

First, Corona Labs does not support running our products on Hackintoshes, OS-X running in a virtual machine.  But this is likely not the cause of your issues, but just be aware, I can’t take anything to engineering unless you’re running on supported hardware.

The Corona Simulator generally cannot support things that require OS/device oriented libraries.  For instance, the native.showPopup() needs to access the iOS sheet’s for sending email and sms and those simply don’t exist in OS-X for the simulator to use. 

Now as for why you can’t do SMS in the Xcode simulator (which does have the device libraries) I’m not sure about that.  I just did a test and in the Xcode simulator and got the same result.  When I built it for a device, it worked as expected, so I can only assume that the Xcode simulator doesn’t support SMS (which kind of makes sense because it doesn’t have any phone carrier support)

Rob

Hi Rob

This worked as you suggested.

Thanks

Just a couple of things…

First, Corona Labs does not support running our products on Hackintoshes, OS-X running in a virtual machine.  But this is likely not the cause of your issues, but just be aware, I can’t take anything to engineering unless you’re running on supported hardware.

The Corona Simulator generally cannot support things that require OS/device oriented libraries.  For instance, the native.showPopup() needs to access the iOS sheet’s for sending email and sms and those simply don’t exist in OS-X for the simulator to use. 

Now as for why you can’t do SMS in the Xcode simulator (which does have the device libraries) I’m not sure about that.  I just did a test and in the Xcode simulator and got the same result.  When I built it for a device, it worked as expected, so I can only assume that the Xcode simulator doesn’t support SMS (which kind of makes sense because it doesn’t have any phone carrier support)

Rob

Hi Rob

This worked as you suggested.

Thanks