iOS以编程方式更改SMSC [英] iOS change SMSC programmatically

查看:250
本文介绍了iOS以编程方式更改SMSC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个可以测试运营商的不同SMSC(短消息服务中心)的应用程序。因此,我需要更改iPhone用于发送短信的SMSC。有没有办法做到这一点?

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. Is there a way doing this ?

Android提供了一个以SMSC为参数的sendMessage方法,在iOS中是否有相同的功能?我不在乎它是否使用私有API调用,因为我不会发布我的应用程序(仅用于内部测试目的)。任何帮助表示感谢,谢谢。

Android offers an sendMessage method with the SMSC as an parameter, is there a equivalent in iOS ? I don't care if it's using private API Calls since I won't release my app anyway (just for internal testing purposes). Any help appreciated, thanks.

推荐答案

此解决方案适用于非越狱手机,但不会进入应用程序商店。
它使用私有API,它与Android的sendMessage的描述非常相似。

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.

你必须将你的项目链接到CoreTelephony框架(现在公开),创建下面描述的标题。还包含了例子。

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

示例:

#import "CTMessageCenter.h"

BOOL success = [[CTMessageCenter sharedMessageCenter]  sendSMSWithText:@"test" serviceCenter:serviceCenterNumberAsString toAddress:numberAsString];

这篇关于iOS以编程方式更改SMSC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆