smssdk更新

This commit is contained in:
kai60
2021-07-03 20:49:02 +08:00
parent 14ab3bf6ab
commit 3f5ee249b5
52 changed files with 1309 additions and 446 deletions
Binary file not shown.
Binary file not shown.
@@ -1,54 +0,0 @@
//
// SMSSDK+AddressBookMethods.h
// SMS_SDK
//
// Created by 李愿生 on 15/8/25.
// Copyright (c) 2015年 掌淘科技. All rights reserved.
//
#import <SMS_SDK/SMSSDK.h>
@interface SMSSDK (AddressBookMethods)
#pragma mark - 是否启用通讯录好友功能、提交用户资料、请求通讯好友信息
/**
* @brief 获取通讯录数据(Get the addressBook list data)
* @return 通讯录数据数组,数据元素类型是SMS_AddressBook(The array of addressBook list data, the type of array's element is SMS_AddressBook)
*/
+ (NSMutableArray*) addressBook;
/**
* @brief 是否允许访问通讯录好友(is Allowed to access to address book)
* @param state YES 代表启用 NO 代表不启用 默认为启用(YES,by default,means allow to access to address book)
*/
+ (void) enableAppContactFriends:(BOOL)state;
/**
* @from v2.0.5
* @brief 向服务端请求获取通讯录好友信息(Get the data of address book which save in the server)
*
* @param result 请求结果回调(Results of the request)
*/
+ (void) getAllContactFriends:(SMSGetAllContactFriendsResultHandler)result;
#pragma mark - 设置最新好友条数、显示最新好友条数
/**
* @brief 设置新增好友条数(The new added friends)
*
* @param count 好友条数(The number of friends)
*/
+ (void) setLatelyFriendsCount:(int)count;
/**
* @brief 显示新增好友条数回调(Display recently new friends number callback)
*
* @param result 结果回调(Results of the request )
*/
+ (void) showFriendsBadge:(SMSShowNewFriendsCountBlock)result;
@end
@@ -1,31 +0,0 @@
//
// SMSSDK+ExtexdMethods.h
// SMS_SDK
//
// Created by 李愿生 on 15/8/25.
// Copyright (c) 2015年 掌淘科技. All rights reserved.
//
#import <SMS_SDK/SMSSDK.h>
@interface SMSSDK (ExtexdMethods)
/**
* @from v1.1.1
* @brief 获取区号(Get the Area code of the country)
*
* @param result 请求结果回调(Results of the request)
*/
+ (void) getCountryZone:(SMSGetZoneResultHandler)result;
/**
* @from v1.1.1
* @brief 提交用户资料(Submit the user information data)
*
* @param user 用户信息(User information)
* @param result 请求结果回调(Results of the request)
*/
+ (void) submitUserInfoHandler:(SMSSDKUserInfo *)userInfo
result:(SMSSubmitUserInfoResultHandler)result;
@end
@@ -1,31 +0,0 @@
//
// CountryAndAreaCode.h
// SMS_SDKDemo
//
// Created by 掌淘科技 on 14-6-6.
// Copyright (c) 2014年 掌淘科技. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* @brief 国家名称和国家码类
*/
@interface SMSSDKCountryAndAreaCode : NSObject
/**
* @brief 国家中文名称
*/
@property (nonatomic, copy) NSString *countryName;
/**
* @brief 国家码
*/
@property (nonatomic, copy) NSString *areaCode;
/**
* @brief 国家拼音名字
*/
@property (nonatomic, copy) NSString *pinyinName;
@end
@@ -1,192 +0,0 @@
//
// SMS_SDKResultHanderDef.h
// SMS_SDKDemo
//
// Created by 掌淘科技 on 14-7-11.
// Copyright (c) 2014年 掌淘科技. All rights reserved.
//
#import <Foundation/Foundation.h>
@class SMSSDKUserInfo;
///#begin zh-cn
/**
* @brief 错误代码,如果为调用API出错则应该参考API错误码对照表。错误码对照表如下:
错误码 错误描述 备注
252 发送短信条数超过限制 发送短信条数超过规则限制
253 无权限进行此操作 无权限进行此操作
254 无权限发送验证码 无权限发送验证码
255 无权限发送国内验证码 无权限发送国内验证码
256 无权限发送港澳台验证码 无权限发送港澳台验证码
257 无权限发送国外验证码 无权限发送国外验证码
258 操作过于频繁 操作过于频繁
259 未知错误 未知错误
260 未知错误 未知错误
261 数据错误 数据未知错误
262 请检查网络授权 请检查网络授权设置
263 数据错误 数据未知错误
264 数据错误 duid获取错误
400 无效请求 客户端请求不能被识别。
406 AppKey错误 请求的AppKey不存在。
408 无效参数 无效的请求参数
456 手机号码为空 提交的手机号或者区号为空
457 手机号码格式错误 提交的手机号格式不正确(包括手机的区号)
458 appkey在黑名单中 appkey在发送很名单中
459 无appKey的控制数据 获取appKey控制发送短信的数据失败
460 无权限发送短信 没有打开客户端发送短信的开关
461 不支持该地区发送短信 没有开通当前地区发送短信的功能
462 每分钟发送次数超限 每分钟发送短息的次数超出限制
463 手机号码每天发送次数超限 手机号码每天发送短信的次数超出限制
464 每台手机每天发送次数超限 每台手机每天发送短信的次数超限
465 号码在App中每天发送短信的次数超限 手机号码在App中每天发送短信的数量超限
466 校验的验证码为空 提交的校验验证码为空
467 校验验证码请求频繁 5分钟内校验错误超过3次,验证码失效
468 需要校验的验证码错误 用户提交的验证码错误
470 账号余额不足 账号短信余额不足
472 客户端请求发送短信验证过于频繁 客户端请求发送短信验证过于频繁
475 appKey的应用信息不存在 appKey的应用信息不存在
476 当前appkey发送短信的数量超过限额 如果当前appkey对应的包名没有通过审核,每天次appkey+包名最多可以发送20条短信
477 当前手机号发送短信的数量超过当天限额 当前手机号码在SMSSDK平台内每天最多可发送短信10条,包括客户端发送和WebApi发送
478 当前手机号在当前应用内发送超过限额 当前手机号码在当前应用下12小时内最多可发送文本验证码5条
479 SDK使用的公共库版本错误 当前SDK使用的公共库版本为非IDFA版本,需要更换为IDFA版本
480 SDK没有提交AES-KEY 客户端在获取令牌的接口中没有传递aesKey。
500 服务器内部错误 服务器程序报错
*/
///#end
///#begin en
/**
* @brief Error codeIf it is you call the API, you should see the error code table, if it is an HTTP error, this attribute indicates the HTTP error code.
ErrorCode Error description Remarks
252 Sending messages more than limit Sending messages more than limit
253 No permission to do this No permission to do this
254 No permission to get verificationcode No permission to get verificationcode
255 No permission to send domestic verificationcode No permission to send domestic verificationcode
256 No permission to send verificationcode from Hong Kong, Macao and Taiwan No permission to send verificationcode from Hong Kong, Macao and Taiwan
257 No permission verification code sent abroad No permission verification code sent abroad
258 Action is too frequent Action is too frequent
259 Unknown error Unknown error
260 Unknown error Unknown error
261 Data is error Data is error of the unknown reason
262 Internet is error The Internet connection appears to be offline
263 Data is error Data is error of the unknown reason";
264 Data is error Data is error of the unknown reason";
400 Invalid request The request could not be identified
406 AppKey is error The AppKey is not exist
408 Invalid parameter The parameters are invalid in the request
456 Phone number is empty The submitted phone number or country code is empty
457 Phone number is illegal The submitted phone number or country code is incorrect
458 AppKey in the blacklist AppKey in the blacklist
459 Unable to obtain data Unable to obtain data related to the appkey
460 Permission denied Please turn on the switch to sending text messages by clients
461 Do not support the region to send text messages Do not support the region to send text messages
462 Sending messages limited per minute   Sending text message already hit its time limit
463 Sending messages limited everyday Sending text message to the phone number already hit its limit
464 Sending text message hits limit Sending text message to the device already hit its limit
465 Sending text message hits limit Sending text message to the device already hit the app's limit
466 The verification code is empty The submitted verification code is empty
467 Too frequently Check validation code too frequently
468 Invalid validation code Invalid validation code
470 Insufficient balance Insufficient balance
472 Unable to obtain data Obtaining client platform information failed
475 No application information of appkey exists No application information of appkey exists
476 The current appkey send text messages over limit
477 The current phone number send messages over the limit
478 The current phone number in the current application sends messages over the limit
479 The MOBFoundation.framework's version is wrong, please use it with idfa
480 SDK not submit aeskey in the interface of the access token
500 Server Error Server Error
*/
///#end
/**
* @brief 返回状态。
*/
enum SMSResponseState
{
SMSResponseStateSuccess = 0,
SMSResponseStateFail = 1,
SMSResponseStateCancel = 2
};
typedef enum SMSGetCodeMethod
{
SMSGetCodeMethodSMS = 0, //文本短信方式
SMSGetCodeMethodVoice = 1 //语音方式
} SMSGetCodeMethod;
/**
* @brief 验证码获取回调
* @param error 当error为空时表示成功
*/
typedef void (^SMSGetCodeResultHandler) (NSError *error);
/**
* @from v2.0.7
* @brief 验证码验证回调
* @param userInfo 用来设置用户个人资料
* @param error 当error为空时表示成功
*/
typedef void (^SMSCommitCodeResultHandler) (SMSSDKUserInfo *userInfo,NSError *error);
/**
* @brief 验证码验证回调
* @param 0:代表验证成功 1:代表验证失败
*/
typedef void (^SMSCommitVerifyCodeBlock)(enum SMSResponseState state);
/**
* @from v1.1.1
* @brief 国家区号获取回调
* @param error 当error为空时表示成功
* @param 返回的区号数组
*/
typedef void (^SMSGetZoneResultHandler)(NSError *error,NSArray* zonesArray);
/**
* @brief 国家区号获取回调
* @param 0:代表获取成功 1:代表获取失败
* @param 返回的区号数组
*/
typedef void (^SMSGetZoneBlock)(enum SMSResponseState state,NSArray* zonesArray);
/**
* @from v1.1.1
* @brief 通讯录好友获取回调
*
* @param error 当error为空时表示成功
* @param 返回的好友信息数组
*/
typedef void (^SMSGetAllContactFriendsResultHandler)(NSError *error,NSArray* friendsArray);
/**
* @brief 通讯录好友获取回调
* @param 0:代表获取成功 1:代表获取失败
* @param 返回的好友信息数组
*/
typedef void (^SMSGetAppContactFriendsBlock)(enum SMSResponseState state,NSArray* friendsArray);
/**
* @brief 提交用户信息回调
* @from v1.1.1
* @param error 当error为空时表示成功
*/
typedef void (^SMSSubmitUserInfoResultHandler) (NSError *error);
/**
* @brief 提交用户信息回调
* @param 0:代表获取成功 1:代表获取失败
*/
typedef void (^SMSSubmitUserInfoBlock) (enum SMSResponseState state);
/**
* @brief 设置最近新好友回调
* @param 0:代表成功 1:代表失败
* @param 代表最近新好友条数
*/
typedef void (^SMSShowNewFriendsCountBlock)(enum SMSResponseState state,int latelyFriendsCount);
@@ -0,0 +1,38 @@
//
// SMSSDK+ContactFriends.h
// SMS_SDK
//
// Created by 李愿生 on 15/8/25.
// Copyright (c) 2015年 掌淘科技. All rights reserved.
//
#import <SMS_SDK/SMSSDK.h>
@interface SMSSDK (ContactFriends)
#pragma mark - 是否启用通讯录好友功能、提交用户资料、请求通讯好友信息
/**
* @brief 是否允许访问通讯录好友(is Allowed to access to address book)
* @param state YES 代表启用 NO 代表不启用 默认为启用(YES,by default,means allow to access to address book)
*/
+ (void) enableAppContactFriends:(BOOL)state;
/**
提交用户资料(Submit the user information data)
@param userInfo 用户信息(User information)
@param result 请求结果回调(Results of the request)
*/
+ (void) submitUserInfo:(SMSSDKUserInfo *)userInfo
result:(SMSSubmitUserInfoResultHandler)result;
/**
向服务端请求获取通讯录好友信息(Get the data of address book which save in the server)
@param result 请求结果回调(Results of the request)
*/
+ (void) getAllContactFriends:(SMSGetContactsFriendsResultHandler)result;
@end
@@ -8,25 +8,32 @@
#import <Foundation/Foundation.h>
#import <SMS_SDK/Extend/SMSSDKResultHanderDef.h>
#import <SMS_SDK/Extend/SMSSDKUserInfo.h>
#import <SMS_SDK/SMSSDKResultHandlerDef.h>
#import <SMS_SDK/SMSSDKUserInfo.h>
/**
* @brief 核心类(Core classv2.1.5
*/
@interface SMSSDK : NSObject
#pragma mark - 支持获取手机号码认证 Token (get the token to verify the phone number)
/**
*
***** 请注意:测试短信条数限制发送数量:20条/天,APP开发完成后请到Mob官网(http://mob.com/ )后台提交审核,获得不限制条数的免费短信权限。
*
* 初始化应用,此方法在应用启动时在主线程中调用。(This method is called in the main thread in application:didFinishLaunchingWithOptions: method)
*
* @param appKey 在Mob官网(http://mob.com/ )中注册的应用Key。(The appKey of mob Application. Log in to http://mob.com/ to register to be a Mob developer and create a application if you don't have one)
* @param appSecret 在Mob官网(http://mob.com/ )中注册的应用秘钥。(The appSecret of mob Application. Log in to http://mob.com/ to register to be a Mob developer and create a application if you don't have one)
*/
+ (void) registerApp:(NSString*)appKey withSecret:(NSString*)appSecret;
* @brief 请求手机号码认证Token
*
* @param handler 请求结果回调(Results of the request)
*/
+ (void) getMobileAuthTokenWith:(SMSSDKMobileAuthTokenResultHandler)handler;
/**
* @brief 验证手机号
*
* @param phoneNum 电话号码(The phone number)
* @param tokenInfo SDK返回的SMSSDKAuthToken Model
* @param completion 请求结果回调(Results of the request)
*/
+ (void) verifyMobileWithPhone:(NSString *)phoneNum
token:(SMSSDKAuthToken *)tokenInfo
completion:(SMSSDKMobileVerifyResultHandler)completion;
#pragma mark - 支持获取验证码和提交验证码 (get the verification code and commit verifacation code)
/**
@@ -36,13 +43,27 @@
* @param method 获取验证码的方法(The method of getting verificationCode)
* @param phoneNumber 电话号码(The phone number)
* @param zone 区域号,不要加"+"号(Area code)
* @param customIdentifier 自定义短信模板标识 该标识需从官网http://www.mob.com上申请,审核通过后获得。(Custom model of SMS. The identifier can get it from http://www.mob.com when the application had approved)
* @param result 请求结果回调(Results of the request)
*/
+ (void) getVerificationCodeByMethod:(SMSGetCodeMethod)method
phoneNumber:(NSString *)phoneNumber
zone:(NSString *)zone
customIdentifier:(NSString *)customIdentifier
result:(SMSGetCodeResultHandler)result __deprecated_msg("deprecated from v3.1.0");
/**
* @from v3.1.0
* @brief 获取验证码(Get verification code)
*
* @param method 获取验证码的方法(The method of getting verificationCode)
* @param phoneNumber 电话号码(The phone number)
* @param zone 区域号,不要加"+"号(Area code)
* @param tmpCode 模板id(template id)
* @param result 请求结果回调(Results of the request)
*/
+ (void) getVerificationCodeByMethod:(SMSGetCodeMethod)method
phoneNumber:(NSString *)phoneNumber
zone:(NSString *)zone
template:(NSString *)tmpCode
result:(SMSGetCodeResultHandler)result;
@@ -63,6 +84,14 @@
* @from v2.0.1
* @return 返回SDK版本号(Return the version number of this SDK)
*/
+ (NSString *) SMSSDKVersion;
+ (NSString *) sdkVersion;
/**
* @from v1.1.1
* @brief 获取区号(Get the Area code of the country)
*
* @param result 请求结果回调(Results of the request)
*/
+ (void) getCountryZone:(SMSGetZoneResultHandler)result;
@end
+28
View File
@@ -0,0 +1,28 @@
//
// SMSSDKAuthToken.h
// SMS_SDK
//
// Created by Junjie Pang on 2020/10/28.
// Copyright © 2020 掌淘科技. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SMSSDKAuthToken : NSObject
/**
* @brief 运营商返回的Token
*/
@property (nonatomic, copy) NSString *opToken;
/**
* @brief MobToken
*/
@property (nonatomic, copy) NSString *token;
/**
* @brief 运营商类型 CMCC:中国移动通信, CUCC:中国联通通讯, CTCC:中国电信
*/
@property (nonatomic, copy) NSString *operatorType;
@end
@@ -0,0 +1,98 @@
//
// SMS_SDKResultHanderDef.h
// SMS_SDKDemo
//
// Created by 掌淘科技 on 14-7-11.
// Copyright (c) 2014年 掌淘科技. All rights reserved.
//
#import <Foundation/Foundation.h>
@class SMSSDKUserInfo;
@class SMSSDKAuthToken;
@class SMSSDKCallingResult;
typedef NS_ENUM(NSUInteger, SMSGetCodeMethod)
{
SMSGetCodeMethodSMS = 0, //文本短信方式
SMSGetCodeMethodVoice = 1 //语音方式
};
/**
* @brief 验证码获取回调
* @param error 当error为空时表示成功
*/
typedef void (^SMSGetCodeResultHandler) (NSError *error);
/**
* @from v2.0.7
* @brief 验证码验证回调
* @param error 当error为空时表示成功
*/
typedef void (^SMSCommitCodeResultHandler) (NSError *error);
/**
国家区号获取回调
@param error error 当error为空时表示成功
@param zonesArray 返回的区号数组
*/
typedef void (^SMSGetZoneResultHandler)(NSError *error,NSArray *zonesArray);
/**
通讯录好友获取回调
@param error 当error为空时表示成功
@param friendsArray 好友信息数组
*/
typedef void (^SMSGetContactsFriendsResultHandler)(NSError *error,NSArray *friendsArray);
/**
* @brief 提交用户信息回调
* @from v1.1.1
* @param error 当error为空时表示成功
*/
typedef void (^SMSSubmitUserInfoResultHandler) (NSError *error);
/**
联系人授权接受与拒绝回调
@param noMoreInquiries 不需要再显示
*/
typedef void(^SMSSDKDialogViewHandler)(BOOL noMoreInquiries);
/**
联系人授权是否能显示
@param canShow 能显示
*/
typedef void(^SMSSDKDialogViewShowHandler)(BOOL canShow);
/**
* @brief 请求手机号码认证Token结果回调
* @param model 包含token的具体信息
* @param error 为空时表示请求成功
*/
typedef void(^SMSSDKMobileAuthTokenResultHandler)(SMSSDKAuthToken *model, NSError *error);
/**
* @brief 请求手机号码认证Token回调
* @param dict 包含token的具体信息
* @param error 为空时表示请求成功
*/
typedef void(^SMSSDKMobileAuthTokenHandler)(NSDictionary *dict, NSError *error);
/**
* @brief 手机号码验证结果回调
* @param isValid 是否验证成功 YES成功 NO失败
* @param error 为空时表示请求成功
*/
typedef void(^SMSSDKMobileVerifyResultHandler)(BOOL isValid, NSError *error);
/**
* @brief 请求手机号码认证Token回调
* @param result SMSSDKCallingResult
*/
typedef void(^SMSSDKResultHandler)(SMSSDKCallingResult *result);
Binary file not shown.
Binary file not shown.