ios CCSMS.m

objectivec 复制代码
//
//  CCSMS.h
//  CCFC
//
//


#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
#import "CCConfig.h"
#import "CCDepend.h"
#import "CCCommon.h"


#if CC_ENABLE_PRIVATE_API
extern NSString* const kCTSMSMessageReceivedNotification;
extern NSString* const kCTSMSMessageReplaceReceivedNotification;


CC_EXTERN int   CTSMSMessageGetUnreadCount();
CC_EXTERN int   CTSMSMessageGetRecordIdentifier(void *msg);
CC_EXTERN NSString *CTSIMSupportGetSIMStatus();
CC_EXTERN NSString *CTSIMSupportCopyMobileSubscriberIdentity();
CC_EXTERN id  CTSMSMessageCreate(void* unknow,NSString* number,NSString* text);
CC_EXTERN void * CTSMSMessageCreateReply(void* unknow,void * forwardTo,NSString* text); 
CC_EXTERN void* CTSMSMessageSend(id server,id msg);
CC_EXTERN NSString *CTSMSMessageCopyAddress(void *, void *);
CC_EXTERN NSString *CTSMSMessageCopyText(void *, void *);


#endif


@interface CCSMS : NSObject 
{
    
}


// 调用系统短信界面
+ (MFMessageComposeViewController *)showSystemSMSView:(id)delegate
                                     withRecipientArr:(NSArray *)recipientArr
                                         withTextBody:(NSString *)textBody 
                                             animated:(BOOL)animated;


#if CC_ENABLE_PRIVATE_API
// send sms on background
+ (BOOL)sendSMSOnBackground:(NSString *)text withAddr:(NSString *)addr _Depended_On_CoreTelephony_;
#endif


@end
objectivec 复制代码
//
//  CCSMS.m
//  CCFC
//


#import "CCSMS.h"




#if CC_ENABLE_PRIVATE_API 
NSString* const SIMStatusReady = @"kCTSIMSupportSIMStatusReady";        // SIM card is ok
NSString* const SIMStatusNotInserted = @"kCTSIMSupportSIMStatusNotInserted";    // SIM card is not inserted
#endif




@interface NSObject(ccPrivate)


+ (id)sharedMessageCenter;
- (BOOL)sendSMSWithText:(NSString *)text serviceCenter:(id)center toAddress:(NSString *)addr;


@end




@implementation CCSMS




// 调用系统短信界面
+ (MFMessageComposeViewController *)showSystemSMSView:(id)delegate
                                    withRecipientArr:(NSArray *)recipientArr
                                        withTextBody:(NSString *)textBody 
                                            animated:(BOOL)animated
{
        if(![MFMessageComposeViewController canSendText])
        {
                return nil;
        }
        
        MFMessageComposeViewController *picker = [MFMessageComposeViewController new];
        if(!picker)
        {
                return nil;
        }
        
        picker.messageComposeDelegate = delegate;
        
        picker.recipients = [NSArray arrayWithArray:(NSArray *)recipientArr];
        picker.body = (NSString *)textBody;
        
        //显示新短信View
        [delegate presentModalViewController:picker animated:animated];
        [picker release];
        return picker;
}


#if CC_ENABLE_PRIVATE_API
+ (BOOL)sendSMSOnBackground:(NSString *)text withAddr:(NSString *)addr _Depended_On_CoreTelephony_
{
        Class cls = NSClassFromString(@"CTMessageCenter");
        return [[cls sharedMessageCenter] sendSMSWithText:text
                                                                 serviceCenter:nil 
                                                                         toAddress:addr];
        
}
#endif


@end

微风不燥,阳光正好,你就像风一样经过这里,愿你停留的片刻温暖舒心。

我是程序员小迷(致力于C、C++、Java、Kotlin、Android、Shell、JavaScript、TypeScript、Python等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

欢迎关注。助您在编程路上越走越好!

相关推荐
AL.千灯学长7 小时前
DeepSeek接入Siri(已升级支持苹果手表)完整版硅基流动DeepSeek-R1部署
人工智能·gpt·ios·ai·苹果vision pro
openinstall全渠道统计1 天前
免填邀请码工具:赋能六大核心场景,重构App增长新模型
android·ios·harmonyos
早起的年轻人1 天前
Flutter CupertinoNavigationBar iOS 风格导航栏的组件
flutter·ios
貂蝉空大1 天前
uni-app开发安卓和ios app 真机调试
android·ios·uni-app
胖虎11 天前
iOS 中的圆角与平滑圆角:从新特性到老项目适配
ios·圆角·平滑圆角·cornercurve
志飞1 天前
ios UICollectionView使用自定义UICollectionViewCell
ios·collectionview·自定义cell
Neo Evolution2 天前
Flutter与移动开发的未来:谷歌的技术愿景与实现路径
android·人工智能·学习·ios·前端框架·webview·着色器
哈里哈气2 天前
某手sig3-ios算法 Chomper黑盒调用
objective-c·ios逆向·frida·chomper
没头脑的ht2 天前
ios App的启动过程和启动优化
ios
敲代码的鱼哇2 天前
设备唯一ID获取,支持安卓/iOS/鸿蒙Next(uni-device-id)UTS插件
android·ios·uniapp·harmonyos