发送 iMessage 尽可能简单 iOS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10850122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending an iMessage as simple as possible iOS
提问by Jordan
I want to be able to programmatically send an iMessage without anything else being done except calling a function that will send a text to a number with a message, both of which are text boxes. I'd really appreciate some sample code as I've hunted the net but nothing I've found will help. This is not for a commercial app, just me so it can use Private frameworks, or anything that will do the job. Thanks.
我希望能够以编程方式发送 iMessage,除了调用一个将文本发送到带有消息的数字的函数外,无需执行任何其他操作,这两个都是文本框。我真的很感激一些示例代码,因为我已经在网上搜寻过,但我发现没有任何帮助。这不适用于商业应用程序,仅适用于我,因此它可以使用私有框架或任何可以完成这项工作的东西。谢谢。
采纳答案by woz
The only way to send a message is to the MessageUI framework. There is an example of how to do this in the iOS documentation:
发送消息的唯一方法是发送到 MessageUI 框架。在 iOS 文档中有一个如何执行此操作的示例:
Edit:I just noticed this question is a duplicate of this: how to use MessageUI framework to send iMessage messages on iPhone
编辑:我刚刚注意到这个问题是这个问题的重复:如何使用 MessageUI 框架在 iPhone 上发送 iMessage 消息
Correction:It appears that you can use CoreTelephony to send a message:
更正:看来您可以使用 CoreTelephony 发送消息:
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:message serviceCenter:nil toAddress:number];
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:message serviceCenter:nil toAddress:number];
The comment from Jordan Brown led me to this. I do suspect that this might get you banned from the App Store, but I know you said you aren't concerned with that.
Jordan Brown 的评论使我想到了这一点。我确实怀疑这可能会让你被 App Store 禁止,但我知道你说过你并不关心这个。