问题描述
我正在使用iOS 6 iphone 4S,我希望能够发送未被注意的短信。
因此在这种情况下使用标准视图控制器将不起作用。
我尝试使用
I am using a iOS 6 iphone 4S and I want to be able to send the unnoticed sms messages.So using the standard view controller won't work in this case.I tried using
- (BOOL)sendSMSWithText:(id)arg1 serviceCenter:(id)arg2 toAddress:(id)arg3;
但它不发送任何内容并返回NO。我使用nil作为arg2。
but it doesn't send anything and returns NO. I used nil for arg2.
有人可以建议在iOS 6上做这个吗?(对于越狱设备)
Can someone suggest a way to do it on iOS 6?(for jailbroken devices)
推荐答案
找出原因 - (BOOL)sendSMSWithText:(id)arg1 serviceCenter:(id)arg2 toAddress:(id)arg3;
自iOS 6起无效。
Found out why - (BOOL)sendSMSWithText:(id)arg1 serviceCenter:(id)arg2 toAddress:(id)arg3;
is not working since iOS 6.
此API受权利 com.apple.CommCenter.Messages-send $ c保护$ C>。只需将此权利设置为true即可签署您的应用。它比我的另一个答案(XPC方法)要好得多,原因有两个:
This API is protected by the entitlement com.apple.CommCenter.Messages-send
. Just sign your app with this entitlement set to true. It's much better than my another answer here (XPC method) because of the two main reasons:
-
sendSMSWithText
告诉您邮件已成功发送 - 使用
sendSMSWithText
发送的邮件未保存在SMS数据库中,并且可以在任何地方都看不到。另一方面,使用XPC方法发送的消息正保存在SMS数据库中,可以在消息应用程序中看到。
sendSMSWithText
tells you whethere message was sent successfully- Messages sent using
sendSMSWithText
are not being saved in the SMS database and can't be seen anywhere. On the other hand, messages sent using XPC method are being saved in SMS database and can be seen in Messages application.
所以,赢赢得。我强烈建议删除XPC方法,因为它使用的是非常低级别的API,可以在新的iOS版本中轻松更改。即使在iOS 7中也可以找到 sendSMSWithText
,我认为它不会很快被删除。
So, win win. I strongly suggest dropping XPC method also because it's using pretty low level API that can change easily in new iOS version. sendSMSWithText
can be found even in iOS 7 and I don't think it will be dropped any time soon.
更新
要在iOS 7及更高版本上使用此API,您需要添加bool值设置为true的其他权利 - com.apple.coretelephony.Identity.get
。
In order to use this API on iOS 7 and above you need to add another entitlement with bool value set to true - com.apple.coretelephony.Identity.get
.
这篇关于在越狱设备上以编程方式发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!