Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

ios - Send programmatically SMS on jailbreak device

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;

but it doesn't send anything and returns NO. I used nil for arg2.

Can someone suggest a way to do it on iOS 6?(for jailbroken devices)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found out why - (BOOL)sendSMSWithText:(id)arg1 serviceCenter:(id)arg2 toAddress:(id)arg3; is not working since iOS 6.

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:

  1. sendSMSWithText tells you whethere message was sent successfully
  2. 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.

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.

UPDATE

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...