【问题标题】:iOS message composer view inside titanium applicationTitan应用程序内的iOS消息编辑器视图
【发布时间】:2012-12-26 08:26:04
【问题描述】:

目前我正在使用以下代码来显示消息编写器,但它会打开本机 iOS 消息应用程序并且我的应用程序会进入后台。

Titanium.Platform.openURL('sms:'+e.rowData.value);

但我想在我的应用程序中显示消息编写器。

有什么方法可以在我的钛应用程序中显示iOS的消息撰写窗口?

我搜索了很多,但没有得到任何解决方案。 appcelerator documentation 中没有关于消息编写器的任何内容。

提前致谢

【问题讨论】:

  • 我尝试使用 Rahul 的帖子分享。 Ti.Platform.openURL('sms://' +123456789 + '&body=' + encodeURIComponent("测试消息"));也为我工作。
  • @DarshanaPatil:您确定提供的解决方案会在我们自己的应用程序中打开消息窗口吗?还是直接打开iOS系统的消息应用?

标签: iphone ios titanium appcelerator mfmessagecomposeview


【解决方案1】:

不使用模块我有更好的解决方案

Ti.Platform.openURL('sms://' +Your_phone_number + '&body=' + encodeURIComponent(MESSAGE_IN_STRING));

它对我有用。

【讨论】:

  • 您确定提供的解决方案会在我们自己的应用程序中打开消息窗口吗?还是直接打开iOS系统的消息应用?
  • 会打开iOS系统的消息应用。
【解决方案2】:

试试这个,

var SMS = require('ti.sms');
var sms = SMS.createSMSDialog({
    animated: true
});
sms.barColor = 'black';
sms.toRecipients = [
    '5678309' // who should receive the text? put their numbers here!
];
sms.messageBody = 'This is a text message.';
sms.addEventListener('complete', function(evt) {
    if (evt.success) {
        alert('SMS sent!');
    }
    else {
        switch (evt.result) {
            case SMS.CANCELLED:
                alert('User cancelled SMS!');
                break;
            case SMS.FAILED:
            default:
                alert(evt.error);
                break;
        }
    }
});
sms.open();

【讨论】:

  • 这行不通,因为您正在使用除钛以外的任何其他模块来显示消息窗口(这就是您使用 require('ti.sms') 的原因)
  • 是否可以从列表中选择联系人而不是预先填充电话号码?
【解决方案3】:

目前(2013 年 1 月 1 日)Titanium SDK 中没有内置模块可将原生 iOS SMS 视图集成到 Titanium 应用程序。有很多第三方模块可以做到这一点。

  1. TiSMSDialog
  2. benCoding.SMS

我还为此开发了一个模块,你可以在这里找到它MMP_SMS

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    • 1970-01-01
    相关资源
    最近更新 更多