首页
/ SMSDialog 模块技术文档

SMSDialog 模块技术文档

2024-12-23 17:57:15作者:羿妍玫Ivan

1. 安装指南

获取模块

您可以通过以下两种方式获取并安装 SMSDialog 模块:

  1. 手动下载安装

    • 下载最新版本的 ZIP 文件。
    • 参考 Titanium 文档 了解如何安装模块。
  2. 使用 gitTio CLI 安装

    • 使用以下命令通过 gitTio CLI 安装模块:
      $ gittio install com.omorandi
      

2. 项目的使用说明

概述

SMSDialog 模块扩展了 Appcelerator Titanium Mobile 框架,实现了一个 iPhone 对话窗口,允许用户在应用程序内发送短信。该模块的 API 与 Ti.UI.EmailDialog 对象的 API 非常相似,支持预填充收件人和短信内容。自 v1.1.0 版本起,模块还支持添加附件,从而能够发送 MMS(多媒体短信)。

功能特点

  • 在应用程序内发送短信。
  • 支持预填充收件人和短信内容。
  • 支持添加附件,发送 MMS。

示例代码

以下是一个简单的示例代码,展示如何使用 SMSDialog 模块发送短信:

var smsDialog = require('com.omorandi');

var sms = smsDialog.createSMSDialog({
    recipients: ['1234567890'],
    body: 'Hello, this is a test message!'
});

sms.open();

3. 项目 API 使用文档

createSMSDialog(options)

创建一个新的 SMSDialog 实例。

参数

  • options (Object): 配置选项,包含以下属性:
    • recipients (Array): 收件人电话号码数组。
    • body (String): 短信内容。
    • attachments (Array): 附件路径数组(可选,自 v1.1.0 起支持)。

返回值

  • 返回一个 SMSDialog 实例。

open()

打开短信对话窗口。

示例

sms.open();

close()

关闭短信对话窗口(如果支持)。

示例

sms.close();

4. 项目安装方式

手动安装

  1. 下载最新版本的 ZIP 文件。
  2. 解压 ZIP 文件。
  3. 将解压后的模块文件夹复制到 Titanium 项目的 modules/iphone 目录下。
  4. tiapp.xml 文件中添加模块引用:
    <module>com.omorandi</module>
    

使用 gitTio CLI 安装

使用以下命令通过 gitTio CLI 安装模块:

$ gittio install com.omorandi

作者

  • Olivier Morandi
    • 网站: http://titaniumninja.com
    • 邮箱: olivier.morandi@gmail.com
    • Twitter: olivier_morandi

许可证

Copyright (c) 2010-2014 Olivier Morandi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
登录后查看全文
热门项目推荐