SMS WatchKit多个分隔符 [英] SMS WatchKit multiple number delimiter

查看:149
本文介绍了SMS WatchKit多个分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在让我的WatchKit应用程序预先撰写短信给多个收件人(通过Apple Watch消息应用程序)时遇到了一些麻烦。

I'm having a little trouble getting my WatchKit App to pre-compose an SMS message to multiple recipients (via the Apple Watch message app).

    let messageBody = "hello test message"
    let urlSafeBody = messageBody.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet())
    if let urlSafeBody = urlSafeBody, url = NSURL(string: "sms:8888888888&body=\(urlSafeBody)") {
        WKExtension.sharedExtension().openSystemURL(url)


$。 b $ b

我的问题是,如果您有多个电话号码要从手表发送消息,您如何划分值?

My question is, if you have multiple phone numbers you want to send the message to from the watch, how do you delimit the values?

SMS链接文档条目没有解释从NSURL分割多个recip。

The SMS Links documentation entry does not explain delimiting to multiple recips from an NSURL.

我试过:

NSURL(string: "sms:8888888888,9999999999&body=\(urlSafeBody)")

NSURL(string: "sms:8888888888;9999999999&body=\(urlSafeBody)")

但是消息始终显示仅由第一个数字组成。

but the message always shows up composed only to the first number.

任何帮助表示赞赏!

更新:
iOS:启动包含多个收件人的邮件应用已在评论中链接,表明只有一个收件人在NSURL中被允许。这意味着我试图找出通过watchkit发送短信的任何其他方式......不可能吗?

UPDATE: iOS: Launching Messages app with multiple recipients was linked in comments indicating that only one recipient is allowed in NSURL. This means I am trying to figure out any other way to send an SMS via watchkit... Not possible?

推荐答案

我< a href =http://handleopenurl.com/scheme/apple-text =nofollow noreferrer>找到了一个晦涩难懂的页面给了我答案。原来,这不是由苹果记录的任何地方我能找到的:

I found an obscure page that gave me the answer. Turns out it is not documented by Apple anywhere I could find:

    let urlSafeBody = messageBody.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet())
    if let urlSafeBody = urlSafeBody, url = NSURL(string: "sms:/open?addresses=1-408-555-1212,1-408-555-2121,1-408-555-1221&body=\(urlSafeBody)") {
        WKExtension.sharedExtension().openSystemURL(url)
     }

以上版本将打开Apple Watch上的消息应用程序,其中预先填充了多个收件人。

The above version will open the messages app on the Apple Watch with multiple recipients pre-populated.

多页 表明它不可能,但确实如此。万岁!

There are many pages that state it isn't possible, but it is. Hooray!

感谢@petahchristian的链接,它让我沿着google路径找到这个页面。

Thanks @petahchristian for the links, it led me down a google path to find this page.

更新:为了完整性 - 这是一个相关的问题,我要求从手表上发送一个功能齐全的多个收件人预先写入的短信。 AppleWatch Messages URL可以硬编码但不能变量

UPDATE: for the sake of completeness - here is a related question I asked to get a fully functional multiple recipient pre-written sms from the watch to send. AppleWatch Messages URL works hard coded but not with variables

这篇关于SMS WatchKit多个分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆