iphone - How to send in app sms using rubymotion? -
how send in-app sms (text message) ipone app written in rubymotion?
okay, i've figured out 1 way this, to: https://github.com/parkint/rubymotion_apisampler
make sure put in rakefile:
app.frameworks += %w[messageui]
then here's code view controller:
def send_sms mfmessagecomposeviewcontroller.alloc.init.tap |sms| sms.messagecomposedelegate = self sms.recipients = ["012345678", '000000000'] sms.body = "hello world!" self.presentmodalviewcontroller(sms, animated:true) end if mfmessagecomposeviewcontroller.cansendtext end def messagecomposeviewcontroller(controller, didfinishwithresult:result) nslog("sms result: #{result}") controller.dismissmodalviewcontrolleranimated(true) end
the second method callback need implement in order close sms modal , may want handle various results better or other things, that's gist of it. clone repository above , have play around.
hope helps, got me going.
Comments
Post a Comment