越狱手机发送短信
http://stackoverflow.com/questions/19175209/sending-sms-using-ctmessagecenter-ios-7
下面的代码在IOS7上面无效,经过一番搜索,解决方案如下。亲测试有效。
I am trying to send sms programmatically using private API. My phone is not jailbroken.
BOOL success = [[CTMessageCenter sharedMessageCenter] sendSMSWithText:@"test 1234..." serviceCenter:nil toAddress:@"0777888888"];
if(success){
NSLog(@"Message SENT");
}else{
NSLog(@"Message not SENT");
}
This code always prints "Message not SENT". Can anyone help me ?
I guess, you have to write the telephone number in E.123 international notation. So add plus sign and country code. For a phone number is USA replace the leading 0 with +1:
[[CTMessageCenter sharedMessageCenter] sendSMSWithText:@"test 1234..." serviceCenter:nil toAddress:@"+1777888888"];
For a phone number is Sri Lanka use the appropriate country code +94.
UPDATE
I've tested old working iOS 5 code under iOS 7... sendSMSWithText:serviceCenter:toAddress:
returns NO
. The same while using the new method sendSMSWithText:serviceCenter:toAddress:withMoreToFollow:
Panagiotis' suggestion seems correct :-/
UPDATE 2
http://stackoverflow.com/a/20425853/2270880 gives the right answer.
Under iOS 7 the app needs two entitlements com.apple.CommCenter.Messages-send
andcom.apple.coretelephony.Identity.get
. Adding additional entitlements via file appname.entitlements
(and set in target's Build Settings > All > Code Signing > Code Signing Entitlements) give you the error
The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.
(0xE8008016).
on non-jailbroken devices.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架