Send programmatically SMS on jailbreak device
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:
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.
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
.
IOS Jailbreak How do intercept SMS / Text Messages
This code snippet should intercept SMS messages- You can extend it for other kinds of notifications. Will work on iOS 5.0.1 as well. Does not work with iMessages though. Link with CoreTelephony framework (there are bunch of private headers there which you'd can class-dump)
#include <dlfcn.h>
#define CORETELPATH "/System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony"
id(*CTTelephonyCenterGetDefault)();
void (*CTTelephonyCenterAddObserver) (id,id,CFNotificationCallback,NSString*,void*,int);
static void telephonyEventCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
NSString *notifyname=(NSString *)name;
if ([notifyname isEqualToString:@"kCTMessageReceivedNotification"])//received SMS
{
NSLog(@" SMS Notification Received :kCTMessageReceivedNotification");
// Do blocking here.
}
}
-(void) registerCallback {
void *handle = dlopen(CORETELPATH, RTLD_LAZY);
CTTelephonyCenterGetDefault = dlsym(handle, "CTTelephonyCenterGetDefault");
CTTelephonyCenterAddObserver = dlsym(handle,"CTTelephonyCenterAddObserver");
dlclose(handle);
id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(
ct,
NULL,
telephonyEventCallback,
NULL,
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
}
Send sms programmatically on iphone
Here is a sample project sendspace.com/file/i6s6j7 Tested it on iPhone 5 with iOS 7.0.4. There is one thing you need to take care of - "Run Script" build phase. This is where application is signed. I used codesign
which will probably not work for you.
In case of a logos tweak you can't sign your tweak with any entitlements you want. Your code will use and is limited to entitlements of application your are hooking. If it's SpringBoard then it's SpringBoard's entitlements that lack com.apple.CommCenter.Messages-send
. So for a SpringBoard tweak my solution with CTMessageCenter
will not work. But XPC solution in my answer here will work. Unfortunately, SMS sent using XPC will show up in SMS database.
There are two possible solutions:
- Daemon. You can sign it with any entitlements you want and do pretty much anything you want.
- Write a tweak to another daemon just for SMS sending. Possible candidate -
com.apple.imagent
located in/System/Library/PrivateFrameworks/IMCore.framework/imagent.app/imagent
. It signed with all the entitlements we need for SMS sending which is obvious because this daemon deals with SMS on lower level. It observes incoming SMS notifications, XPC calls like in my answer and other Instant Messaging related stuff.
Send SMS programmatically without showing message controller
You can not send silent sms from app in iOS if you do these things then apple will reject your application this is not in apple guideline. if you want to do this you have to send it from a webserver using webservices.
Related Topics
Cocoapods Not Installed or Not in Valid State
What Should Image Sizes Be at @1X, @2X and @3X in Xcode
Auto-Layout: What Creates Constraints Named Uiview-Encapsulated-Layout-Width & Height
Presenting Camera Permission Dialog in iOS 8
How to Check Internet Connection in Alamofire
How to Use Apple's New .P8 Certificate for Apns in Firebase Console
How to Get Uiscrollview Vertical Direction in Swift
Uitapgesturerecognizer Tap on Self.View But Ignore Subviews
Single Function to Dismiss All Open View Controllers
How to Color a Uiimage in Swift
Kvo and Arc How to Removeobserver
Error When Trying to Obtain a Certificate: the Specified Item Could Not Be Found in the Keychain
Why am I Getting Ibtool Failed with Exit Code 255
How to Apply Multiple Transforms in Swift
Xcode 6 Keeps Renaming My App's Directory in iOS8 Simulator After Each Run
How to Get Image Metadata in iOS
Preferredinterfaceorientationforpresentation Must Return a Supported Interface Orientation