【问题标题】:How to send in app sms using rubymotion? [closed]如何使用 ruby​​motion 发送应用短信? [关闭]
【发布时间】:2013-05-21 11:02:55
【问题描述】:

如何从用 Rubymotion 编写的 iPone 应用发送应用内短信(文本消息)?

【问题讨论】:

    标签: iphone ios sms rubymotion


    【解决方案1】:

    好的,所以我想出了一种方法来做到这一点,感谢: https://github.com/ParkinT/RubyMotion_APISampler

    确保将其放入您的 Rakefile:

    app.frameworks += %w[MessageUI]
    

    然后是您的视图控制器的代码:

    def send_sms
      MFMessageComposeViewController.alloc.init.tap do |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
    

    第二种方法是您需要实现的回调,以便关闭短信模式,您可能希望更好地处理各种结果或做其他事情,但这就是它的要点。克隆上面的存储库并尝试一下。

    希望这会有所帮助,当然可以让我继续前进。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-15
      • 1970-01-01
      • 1970-01-01
      • 2012-11-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多