iOS change SMSC programmatically

前端 未结 2 1172
时光取名叫无心
时光取名叫无心 2021-01-03 16:32

I\'m writing an app which can test different SMSC (Short Message Service Centers) from an operator. Therefore I need to change the SMSC the iPhone is using for sending SMS.

相关标签:
2条回答
  • 2021-01-03 17:09

    This solution works on non-jailbroken phones, but it will not get in the app store. It uses private API's and it's very similar your description of Android's sendMessage.

    You'll have to link your project the CoreTelephony framework (public now), and create the header described bellow. There's and example included too.

    CTMessageCenter.h:

    #import <Foundation/Foundation.h>
    
    @interface CTMessageCenter : NSObject
    {
    }
    
    + (id)sharedMessageCenter;
    - (id)init;
    - (id)sendSMS:(id)fp8;
    - (id)sendMMSFromData:(id)fp8 messageId:(unsigned int)fp12;
    - (id)sendMMS:(id)fp8;
    - (id)send:(id)fp8;
    - (id)incomingMessageWithId:(unsigned int)fp8 telephonyCenter:(struct __CTTelephonyCenter *)fp12 isDeferred:(BOOL)fp16;
    - (int)incomingMessageCount;
    - (id)allIncomingMessages;
    - (void)acknowledgeIncomingMessageWithId:(unsigned int)fp8;
    - (void)acknowledgeOutgoingMessageWithId:(unsigned int)fp8;
    - (id)incomingMessageWithId:(unsigned int)fp8;
    - (id)deferredMessageWithId:(unsigned int)fp8;
    - (id)statusOfOutgoingMessages;
    - (id)encodeMessage:(id)fp8;
    - (id)decodeMessage:(id)fp8;
    - (BOOL)isMmsEnabled;
    - (BOOL)isMmsConfigured;
    - (BOOL)sendSMSWithText:(id)fp8 serviceCenter:(id)fp12 toAddress:(id)fp16;
    
    @end
    

    Example:

    #import "CTMessageCenter.h"
    
    BOOL success = [[CTMessageCenter sharedMessageCenter]  sendSMSWithText:@"test" serviceCenter:serviceCenterNumberAsString toAddress:numberAsString];
    
    0 讨论(0)
  • 2021-01-03 17:14

    You need to use AT Command to update SMSC on the SIM card.

    On iOS, you can use Private Framework SKTelephonyController.

    AT Command to get current SMSC on the SIM card: AT+CSCA?

    Write to SIM card: AT+CSCA = "1xxxxxxxxxx",145

    0 讨论(0)
提交回复
热议问题