尽可能简单地发送iMessage iOS [英] Sending an iMessage as simple as possible iOS
问题描述
我希望能够以编程方式发送iMessage而不做任何其他事情,除了调用一个函数,该函数将文本发送到带有消息的数字,这两个文本框都是文本框。
我非常感谢一些示例代码,因为我已经在网上搜索,但我找到的任何内容都没有帮助。
这不是商业应用程序,只是我,所以它可以使用私有框架,或任何能够完成这项工作的东西。
谢谢。
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.
推荐答案
发送消息的唯一方法是MessageUI框架。在iOS文档中有一个如何执行此操作的示例:
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:
编辑:我刚刚注意到这个问题与此重复:< a href =https://stackoverflow.com/questions/6453776/how-to-use-messageui-framework-to-send-imessage-messages-on-iphone>如何使用MessageUI框架在iPhone上发送iMessage消息
I just noticed this question is a duplicate of this: how to use MessageUI framework to send iMessage messages on iPhone
更正:您可以使用CoreTelephony发送消息:
Correction: It appears that you can use CoreTelephony to send a message:
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:message serviceCenter:nil toAddress:number];
乔丹布朗的评论让我想到了这一点。我怀疑这可能会让你被禁止进入App Store,但我知道你说你不关心它。
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.
这篇关于尽可能简单地发送iMessage iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!