开发版本-developer——01 first commit

This commit is contained in:
wbzhan
2019-07-08 18:24:03 +08:00
parent 5a10dfa182
commit 8693efe121
386 changed files with 7069 additions and 1951 deletions
@@ -0,0 +1,61 @@
//
// JsonUtils.h
// mtopext
//
// Created by sihai on 13/11/14.
// Copyright (c) 2014 Taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JsonUtils : NSObject
/*!
* 字符串转换成只读json
* @param str 字符串
* @return
* NSDictionary
*/
+ (NSDictionary*) toJson: (NSString*) str;
/*!
* 字符串转换成只读json
* @param str 字符串
* @return
* NSDictionary
*/
+ (NSDictionary*) toJsonWithData: (NSData*) data;
/*!
* 字符串转换成只读json
* @param str 字符串
* @return
* NSMutableDictionary
*/
+ (NSMutableDictionary*) toMutableJsonWithData: (NSData*) data;
/*!
* 字符串转换成读写json
* @param str 字符串
* @return
* NSMutableDictionary
*/
+ (NSMutableDictionary*) toMutableJson: (NSString*) str;
/*!
* 对象转json字符串
* @param data 对象
* @return
* NSString
*/
+ (NSString*) toJsonString: (NSObject*) data;
/*!
* 对象转json字符串的NSData
* @param data 对象
* @return
* NSData
*/
+ (NSData*) toJsonData: (NSObject*) data;
@end
@@ -0,0 +1,38 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 iTeam on 13-3-3.
// Copyright (c) 2013年 亿刀/禚来强 iTeam. All rights reserved.
//
#ifndef TBSDKNetworkSDK_Define_h
#define TBSDKNetworkSDK_Define_h
#define TBSDK_REQUEST_NOT_NETWORK @"tbsdk request not network" //无网络
#define TBSDK_REQUEST_TIME_OUT @"tbsdk request timeout" //请求超时
#define TBSDK_SERVER_TOO_MANY_REDIRECTION @"302跳转次数过多"
#define FUNCTION_LINE [NSString stringWithFormat: @"%s %d", __FUNCTION__, __LINE__]
/** 编译设置
* 如果以framework的方式引入NetworkSDKkNetworkSDKIsFramework的定义不起任何作用
* 如果源码的方式引入NetworkSDK,“TBSDKNetworkSD.h”将将产生条件编译
*/
#define kNetworkSDKIsFramework 0
/*---------------------------------post 消息定义------------------------------------------------------------*/
//自动登录失败
#define kTBSDKNetworkSDKAutoLoginIsFail @"kTBSDKNetworkSDKAutoLoginIsFail"
/*---------------------------------------------------------------------------------------------*/
#endif
#define kFaileSystemErrorCode @"小二很忙,系统很累,请稍后重试"
@@ -0,0 +1,107 @@
//
// TBSDKConnection.h
// TBSDK
//
// Created by 亿刀/禚来强 on 14-3-6.
// Copyright (c) 2014年 Taobao.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TBSDKConnectionProtocol.h"
@protocol TBSDKProgressDelegate;
@protocol TBSDKConnectionDelegate;
//和ASI对应轻易不要修改
typedef enum _TBSDKNetworkErrorType {
TBSDKConnectionFailureErrorType = 1,
TBSDKRequestTimedOutErrorType = 2,
TBSDKAuthenticationErrorType = 3,
TBSDKRequestCancelledErrorType = 4,
TBSDKUnableToCreateRequestErrorType = 5,
TBSDKInternalErrorWhileBuildingRequestType = 6,
TBSDKInternalErrorWhileApplyingCredentialsType = 7,
TBSDKFileManagementError = 8,
TBSDKTooMuchRedirectionErrorType = 9,
TBSDKUnhandledExceptionError = 10,
TBSDKCompressionError = 11,
TBSDKACCSError = 12,
} TBSDKNetworkErrorType;
@interface TBSDKConnection : NSObject
@property (weak) id<TBSDKProgressDelegate>uploadProgressDelegate;
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, unsafe_unretained) TBSDKCachePolicy cachePolicy;
@property (unsafe_unretained) id <TBSDKCacheDelegate> downloadCache;
@property (weak) id <TBSDKProgressDelegate> downloadProgressDelegate;
@property (unsafe_unretained, nonatomic) NSTimeInterval timeOutSeconds;
@property (nonatomic, strong) NSDictionary *responseHeaders;
@property (nonatomic, strong) NSMutableDictionary *requestHeaders;
@property (nonatomic, strong) NSError *error;
@property (nonatomic, weak) id<TBSDKConnectionDelegate>delegate;
@property (nonatomic, strong) NSMutableArray *requestCookies;
@property (nonatomic, strong) NSData *responseData;
@property (nonatomic, strong) NSString *responseString;
@property (nonatomic, unsafe_unretained) NSStringEncoding responseEncoding;
@property (assign,nonatomic) int responseStatusCode;
@property (unsafe_unretained) TBSDKPostFormat postFormat;
@property (strong) NSMutableArray *fileData;
@property (strong) NSHTTPURLResponse *response;
@property (strong) NSMutableData *postBody;
@property (atomic) BOOL isFinished;
// 打点判断是否是http
@property (nonatomic, unsafe_unretained) BOOL isHttp;
@property (nonatomic, strong) NSMutableArray *postData;
@property (nonatomic, unsafe_unretained) int postGzipSize;
// ut dataset dictionary
@property (nonatomic, strong) NSDictionary *utDict;
@property (nonatomic) CFAbsoluteTime networkEndTime;
+ (id)requestWithURL:(NSURL *)newURL;
+ (void) cancelAll;
- (id)initWithURL:(NSURL *)newURL;
- (void)setPostValue:(id<NSObject>)value forKey:(NSString *)key;
- (void)addRequestHeader:(NSString *)header value:(NSString *)value;
- (void)startAsynchronous;
- (void)startSynchronous;
- (void)clearDelegatesAndCancel;
- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
@end
@@ -0,0 +1,20 @@
@class TBSDKConnection;
@protocol TBSDKConnectionDelegate <NSObject>
@optional
- (void)requestStarted:(TBSDKConnection *)connection;
- (void)request:(TBSDKConnection *)connection didReceiveResponseHeaders:(NSDictionary *)responseHeaders;
- (void)request:(TBSDKConnection *)connection willRedirectToURL:(NSURL *)newURL;
- (void)requestFinished:(TBSDKConnection *)connection;
- (void)requestNetworkDataSet:(NSDictionary *) networkDataSet withFinishedTime:(CFAbsoluteTime) finishedTime;
- (void)requestFailed:(TBSDKConnection *)connection;
- (void)requestRedirected:(TBSDKConnection *)connection;
- (void)request:(TBSDKConnection *)connection didReceiveData:(NSData *)data;
- (void)authenticationNeededForRequest:(TBSDKConnection *)connection;
- (void)proxyAuthenticationNeededForRequest:(TBSDKConnection *)connection;
@end
@@ -0,0 +1,90 @@
//
// TBSDKConnectionProtocol.h
// TBSDK
//
// Created by 亿刀/禚来强 on 14-3-6.
// Copyright (c) 2014年 Taobao.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol TBSDKCacheDelegate;
@protocol TBSDKProgressDelegate;
@protocol TBSDKConnectionDelegate;
//和ASI对应轻易不要修改
typedef enum _TBSDKCachePolicy
{
TBSDKUseDefaultCachePolicy = 0,
TBSDKDoNotReadFromCacheCachePolicy = 1,
TBSDKDoNotWriteToCacheCachePolicy = 2,
TBSDKAskServerIfModifiedWhenStaleCachePolicy = 4,
TBSDKAskServerIfModifiedCachePolicy = 8,
TBSDKOnlyLoadIfNotCachedCachePolicy = 16,
TBSDKDontLoadCachePolicy = 32,
TBSDKFallbackToCacheIfLoadFailsCachePolicy = 64
} TBSDKCachePolicy;
typedef enum _TBSDKPostFormat
{
TBSDKMultipartFormDataPostFormat = 0,
TBSDKURLEncodedPostFormat = 1
} TBSDKPostFormat;
@protocol TBSDKConnectionProtocol <NSObject>
@property (unsafe_unretained) id<TBSDKProgressDelegate>uploadProgressDelegate;
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, unsafe_unretained) TBSDKCachePolicy cachePolicy;
@property (unsafe_unretained) id <TBSDKCacheDelegate> downloadCache;
@property (unsafe_unretained, nonatomic) NSTimeInterval timeOutSeconds;
@property (nonatomic, strong) NSDictionary *responseHeaders;
@property (nonatomic, strong) NSMutableDictionary *requestHeaders;
@property (nonatomic, strong) NSError *error;
@property (nonatomic, weak) id<TBSDKConnectionDelegate>delegate;
@property (nonatomic, strong) NSMutableArray *requestCookies;
@property (nonatomic, strong) NSMutableData *responseData;
@property (nonatomic, strong) NSString *responseString;
@property (nonatomic, unsafe_unretained) NSStringEncoding responseEncoding;
@property (assign,readonly) int responseStatusCode;
@property (unsafe_unretained) TBSDKPostFormat postFormat;
@property (nonatomic, strong) NSMutableArray *postData;
+ (id)requestWithURL:(NSURL *)newURL;
- (void)setPostValue:(id<NSObject>)value forKey:(NSString *)key;
- (void)addRequestHeader:(NSString *)header value:(NSString *)value;
- (void)startAsynchronous;
- (void)startSynchronous;
- (void)clearDelegatesAndCancel;
- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
@end
@@ -0,0 +1,18 @@
//
// TBSDKEncryptionUntil.h
// mtopsdk
//
// Created by sihai on 7/5/15.
// Copyright (c) 2015 mtop. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBSDKEncryptionUntil : NSObject
+ (NSData *)encryptionString:(NSString *)string key:(NSString *)key;
+ (NSString *)decryptWithKey:(NSString *)key decrypDta:(NSData *)data;
@end
@@ -0,0 +1,27 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-1-31.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
@class TBSDKServer;
@protocol TBSDKErrorRule;
@protocol TBSDKErrorHandleDelegate <NSObject>
@required
//! 如果返回值不为nil,表示有业务错误,反之,表示服务器返回值没有业务错误,是一次成功的网络请求
- (id<TBSDKErrorRule>)tbsdkErrorHandleWithServer:(TBSDKServer *)server;
@end
@@ -0,0 +1,38 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-2-19.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol TBSDKErrorRule <NSObject>
@required
@property (nonatomic, strong) NSString *errorCode;
@property (nonatomic, strong) NSString *msg;
@optional
@property (nonatomic, strong) NSString *sub_code;
@property (nonatomic, strong) NSString *sub_msg;
@property (nonatomic, strong) NSDictionary *args;
@property (nonatomic, strong) NSDictionary *raw;
//开发调试使用的参数,用户存放代码出错的位置(__FUNCTION__, __LINE__)
@property (nonatomic, strong) NSString *errorLocation;
@property (nonatomic, strong) NSError *error;
@end
@@ -0,0 +1,16 @@
//
// NWHTTPRequestOperation.h
// ALINetworkSDK
//
// Created by Roger.Mu on 5/8/15.
// Copyright (c) 2015 Taobao.com. All rights reserved.
//
#import "TBSDKURLConnectionOperation.h"
@interface TBSDKHTTPRequestOperation : TBSDKURLConnectionOperation
- (void)setCompletionBlockWithSuccess:(void (^)(TBSDKHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(TBSDKHTTPRequestOperation *operation, NSError *error))failure;
@end
@@ -0,0 +1,38 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-3-25.
// Copyright (c) 2013年 yidao. All rights reserved.
//
#ifdef __cplusplus
extern "C" {
#endif
#import <Foundation/Foundation.h>
/** 开关openSDK的log */
void openSDKSwitchLog(BOOL logCtr);
/** 打印log */
void openSDKNSLog(NSString *formate, ...);
//#define MLog(formate, args...) NSLog(formate, args...)// openSDKNSLog(@"%s %d: " formate, __FUNCTION__, __LINE__, ##args)
//#ifdef DEBUG_MODE
#define MLog( s, ... ) openSDKNSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
//#else
//#define DLog( s, ... )
//#endif
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,40 @@
//
// TBSDKMTOPEnvConfig.h
// MtopSDK
//
// Created by Roger on 11/27/14.
// Copyright (c) 2014 mtop. All rights reserved.
//
#import <Foundation/Foundation.h>
#define MTOP_REQUEST_SECURITY_CONTROL @"Security_control"
/** TBSDK环境设置 */
typedef enum
{
environmentDebug = 1, /**< 枚举,预发环境 */
environmentDaily, /**< 枚举,日常环境 */
// environmentDailyTwo, /**< 枚举,日常二套环境 */
environmentRelease /**< 枚举,正式环境 */
}MtopEnvironment;
@interface TBSDKMTOPEnvConfig : NSObject
@property (nonatomic, strong) NSString *appkey;
@property (nonatomic, strong) NSString *appSecret;
@property (nonatomic, strong) NSString *uid;
@property (atomic) BOOL isWhiteSecurity;
@property (nonatomic) MtopEnvironment environment;
//@property (strong, nonatomic) NSString* gatewayDomain;
//@property (nonatomic, strong) NSString *customMtopRequestURL;
@property (nonatomic, strong) NSString *authCode;
+ (id)shareInstance;
- (NSString *)appkey;
- (NSString *)readUtdid;
+ (NSString *)urlEncodeString:(NSString *) string;
@end
@@ -0,0 +1,30 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-7-10.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@class TBSDKServer;
@protocol TBSDKNetworkProgressProtocol <NSObject>
@optional
- (void)setProgress:(float)newProgress;
// Called when the request sends some data
// The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
// bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
- (void)request:(TBSDKServer *)request didSendBytes:(long long)bytes;
@end
@@ -0,0 +1,73 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-2-6.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import "NetworkSDKDefine.h"
#if kNetworkSDKIsFramework
#import <TBSDKNetworkSDK/TBSDKConfiguration.h>
#import <TBSDKNetworkSDK/TBSDKErrorResponse.h>
#import <TBSDKNetworkSDK/TBSDKErrorRule.h>
#import <TBSDKNetworkSDK/TBSDKMTOPServer.h>
#import <TBSDKNetworkSDK/TBSDKTOPServer.h>
#import <TBSDKNetworkSDK/TBSDKServer.h>
#import <TBSDKNetworkSDK/TBSDKServerDelegate.h>
#import <TBSDKNetworkSDK/TBSDKServerQueue.h>
#import <TBSDKNetworkSDK/TBSDKErrorHandleDelegate.h>
#import <TBSDKNetworkSDK/TBSDKObject+Category.h>
#import <TBSDKNetworkSDK/TBSDKConfigurationHelper.h>
#import <TBSDKNetworkSDK/TBSDKJSONBridge.h>
#import <TBSDKNetworkSDK/TBSDKLogUtil.h>
#import <TBSDKNetworkSDK/TBSDKAccountInfo.h>
#import <TBSDKNetworkSDK/TBSDKEncryptionUntil.h>
#import <TBSDKNetworkSDK/TBSDKSendFileObject.h>
#import <TBSDKNetworkSDK/TBSDKNetworkProgressProtocol.h>
#import <TBSDKNetworkSDK/TBSDKNetworkSDKUtil.h>
#import <TBSDKNetworkSDK/TBSDKRequest.h>
#import <TBSDKNetworkSDK/TBSDKMTOPServerBehindFilterProtocol.h>
#import <TBSDKNetworkSDK/TBSDKAntiBrushVerificationFilter.h>
#import <TBSDKNetworkSDK/TBSDKBaseFilter.h>
#import <TBSDKNetworkSDK/TBSDKAvalancheFilter.h>
#import <TBSDKNetworkSDK/TBSDKJSONTolerant.h>
#import <TBSDKNetworkSDK/UIDevice+TBSDKIdentifierAddition.h>
#import <TBSDKNetworkSDK/TBSDKUploadService.h>
#import <TBSDKNetworkSDK/TBSDKRequestProgressProtocol.h>
#else
#import "TBSDKConfiguration.h"
#import "TBSDKErrorResponse.h"
#import "TBSDKErrorRule.h"
#import "TBSDKMTOPServer.h"
//#import "TBSDKTOPServer.h"
#import "TBSDKServer.h"
#import "TBSDKServerDelegate.h"
#import "TBSDKErrorHandleDelegate.h"
#import "TBSDKObject+Category.h"
#import "TBSDKConfigurationHelper.h"
#import "TBSDKJSONBridge.h"
#import "TBSDKLogUtil.h"
#import "TBSDKAccountInfo.h"
#import "TBSDKEncryptionUntil.h"
#import "TBSDKSendFileObject.h"
#import "TBSDKNetworkProgressProtocol.h"
#import "TBSDKNetworkSDKUtil.h"
#import "TBSDKRequest.h"
#import "TBSDKMTOPServerBehindFilterProtocol.h"
//#import "TBSDKAntiBrushVerificationFilter.h"
#import "TBSDKBaseFilter.h"
//#import "TBSDKAvalancheFilter.h"
#import "UIDevice+TBSDKIdentifierAddition.h"
#import "TBSDKUploadService.h"
#import "TBSDKRequestProgressProtocol.h"
#endif
@@ -0,0 +1,22 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-7-19.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBSDKNetworkSDKUtil : NSObject
+ (NSString *)utdid;
+ (NSString*)base64forData:(NSData*)theData;
@end
@@ -0,0 +1,97 @@
//
// PersistentStorage.h
// mtopsdk
//
// Created by sihai on 19/5/15.
// Copyright (c) 2015 mtop. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TBSDKPersistentStorage: NSObject
/*!
* 获取类似NSUserDefaults的standardUserDefaults, 该存储会被icloud备份和恢复
*
* @return
* NSUserDefaults
*/
+ (NSUserDefaults*) standardStorage;
/*!
* 获取存储实例该存储不会被icloud备份和恢复
* @return
* NSUserDefaults子类
*/
+ (TBSDKPersistentStorage*) storageWithoutICloudBackup;
/*!
* 获取指定key的值
* @param key
* @return
*
*/
- (id) objectForKey:(NSString*) key;
/*!
* 获取指定key的值
* @param key
* @return
*
*/
- (id) valueForKey: (NSString*) key;
/*!
* 获取double值
*
*/
- (BOOL) boolForKey: (NSString*) key;
/*!
* 获取double值
*
*/
- (double) doubleForKey: (NSString*) key;
/*!
* 获取int值
*
*/
- (int) integerForKey: (NSString*) key;
/*!
* 获取long值
*
*/
- (long) longForKey: (NSString*) key;
/*!
* 获取long long值
*
*/
- (long long) longLongForKey: (NSString*) key;
/*!
* 设置指定key的值
* @param value
* @param key
* @return
*
*/
- (void) setObject: (id) value forKey: (NSString*) key;
/*!
* 删除指定key的值
* @param key
*
*/
- (void) removeObjectForKey: (NSString*) key;
/*!
* 刷新内存中的改动到磁盘
* @param key
*
*/
- (void) flush;
@end
@@ -0,0 +1,41 @@
//
// TBSDKProgressDelegate.h
// TBSDK
//
// Created by 亿刀/禚来强 on 14-3-6.
// Copyright (c) 2014年 Taobao.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@class TBSDKConnection;
@protocol TBSDKProgressDelegate <NSObject>
@optional
// These methods are used to update UIProgressViews (iPhone OS) or NSProgressIndicators (Mac OS X)
// If you are using a custom progress delegate, you may find it easier to implement didReceiveBytes / didSendBytes instead
#if TARGET_OS_IPHONE
- (void)setProgress:(float)newProgress;
#else
- (void)setDoubleValue:(double)newProgress;
- (void)setMaxValue:(double)newMax;
#endif
// Called when the request receives some data - bytes is the length of that data
- (void)request:(TBSDKConnection *)connection didReceiveBytes:(long long)bytes;
// Called when the request sends some data
// The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
// bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
- (void)request:(TBSDKConnection *)connection didSendBytes:(long long)bytes;
// Called when a request needs to change the length of the content to download
- (void)request:(TBSDKConnection *)connection incrementDownloadSizeBy:(long long)newLength;
// Called when a request needs to change the length of the content to upload
// newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
- (void)request:(TBSDKConnection *)connection incrementUploadSizeBy:(long long)newLength;
@end
@@ -0,0 +1,254 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-1-28.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
/*!
* System parameters
*/
#define SYS_PARAMETER_API_NAME @"api"
#define SYS_PARAMETER_API_VERSOIN @"v"
#define SYS_PARAMETER_SECURITY_APPKEY @"security_appkey"
#define SYS_PARAMETER_APPKEY @"appkey"
#define SYS_PARAMETER_SID @"sid"
#define SYS_PARAMETER_TTID @"ttid"
#define SYS_PARAMETER_TIMESTAMP @"timestamp"
#define SYS_PARAMETER_DEVID @"devid"
#define SYS_PARAMETER_LOCATION @"location"
/*!
* 系统http headers
*/
#define SYS_HTTP_HEADER_PV @"x-pv"
#define SYS_HTTP_HEADER_APPKEY @"x-appkey"
#define SYS_HTTP_HEADER_SID @"x-sid"
#define SYS_HTTP_HEADER_UID @"x-uid"
#define SYS_HTTP_HEADER_TTID @"x-ttid"
#define SYS_HTTP_HEADER_TIMESTAMP @"x-t"
#define SYS_HTTP_HEADER_DEVID @"x-devid"
#define SYS_HTTP_HEADER_LOCATION @"x-location"
#define SYS_HTTP_HEADER_SIGN @"x-sign"
#define SYS_HTTP_HEADER_UTDID @"x-utdid"
#define SYS_HTTP_HEADER_REQBIZ @"x-reqbiz-ext"
#define SYS_HTTP_HEADER_APP_VER @"x-app-ver"
#define SYS_HTTP_HEADER_WUAT @"x-wuat"
/*!
* open api ext paramssdk uses property
*/
#define SYS_HTTP_HEADER_EXTDATA @"x-extdata"
#define SYS_HTTP_HEADER_EXTTYPE @"x-exttype"
#define SYS_HTT_HEADER_ACT @"x-act"
#define SYS_HTTP_HEADER_FEATURES @"x-features"
/*!
* security guard headers
*/
#define SYS_HTTP_HEADER_SIGNTYPE @"x-sign-type"
#define SYS_HTTP_HEADER_UMT @"x-umt"
/*!
* 系统http header 常量
*/
#define M_PV @"5.0"
#define SYS_PARAMETER_DATA @"data"
@protocol TBSDKConnectionProtocol;
typedef enum _TBSDKRequestErrorType
{
TBSDKRequestErrorTypeConnectionFailure = 1, //网络连接失败或者无网络
TBSDKRequestErrorTypeTimedOut = 2, //网络连接超时
TBSDKRequestErrorTypeUserInvalid = 3, // user sid invalid time
TBSDKREquestTooMuchRedirectionErrorType,
} TBSDKRequestErrorType;
@protocol TBSDKRequestDataSource;
@protocol TBSDKRequestDelegate;
@protocol TBSDKRequestProgressProtocol;
//! 网络请求默认超时时间
#define TIME_OUT_SCONDS 10.
@class TBSDKConnection;
/** TBSDK的真正的网络请求类
*
* 此类主要做联网控制,如超时时间、最大联网个数、取消所有网络连接等。
* TBSDK的真正的网络请求类,此类通过delegate来获取网络请求
* 的配置参数(get或post,post的value,需要上传的数据)。
*
*/
@interface TBSDKRequest : NSObject
@property (nonatomic, strong) NSError *error;
//! 代理对象
@property (nonatomic, weak) id<TBSDKRequestDelegate> delegate;
//! 代理对象
@property (nonatomic, weak) id<TBSDKRequestDataSource> dataSource;
//! 上传下载进度代理对象
@property (nonatomic, weak) id<TBSDKRequestProgressProtocol> requestProgressDelegate;
@property (nonatomic, strong, readonly) TBSDKConnection *request;
// api request url
@property (nonatomic, strong) NSURL *url;
// api single request custom host
@property (nonatomic, strong) NSString* customHost;
//! 请求过期时间,默认10s
@property (nonatomic, unsafe_unretained) NSTimeInterval timeOutSeconds;
//! NSData 对象的请求响应数据
@property (nonatomic, retain) NSData *responseData;
//! NSString 对象的请求响应数据
@property (nonatomic, retain) NSString *responseString;
//! http responseStatusCode
@property (nonatomic, unsafe_unretained) int responseStatusCode;
@property (nonatomic, strong, readonly) NSDictionary *responseHeaders;
@property (nonatomic, strong) NSDictionary *requestHeaders;
//! 默认关闭
@property (nonatomic, unsafe_unretained) BOOL useHTTPCache;
@property (nonatomic, unsafe_unretained) BOOL forceRefresh;
@property (nonatomic, strong) NSString *apiMethod;
@property (nonatomic) BOOL isAvalancheCache;
// post method of body gzip size
@property (nonatomic, unsafe_unretained) int gzipLimitedSize;
@property (nonatomic, strong) NSArray *blackCacheKeyParam;
@property (nonatomic, strong) NSMutableDictionary *networkDataSet;
@property (nonatomic) CFAbsoluteTime operationQueueTime;
@property (nonatomic) CFAbsoluteTime networkFinishedTime;
// base property
@property(strong, nonatomic) NSString* userId; // app user's id
@property(strong, nonatomic) NSString* apiName; // 网关URL
@property(strong, nonatomic) NSString* apiVersion; // 网关URL
@property(strong, nonatomic) NSMutableDictionary* protocolParameters; // 协议参数
@property(strong, nonatomic) NSMutableDictionary* httpHeaders; // http请求头
@property(strong, nonatomic) NSMutableDictionary* extParameters; // 扩展参数 (和data参数平级)
@property(strong, nonatomic) NSMutableDictionary* bizParameters; // 业务参数
@property(strong,nonatomic) NSMutableArray* uploadFiles; //
@property(assign, nonatomic) BOOL isUseHttps; // 是否启用https
@property(assign, nonatomic) BOOL isUseHttpPost; // 是否使用http post
@property(strong, nonatomic) NSString* unitPrefix; // 单元化前缀
@property(strong, nonatomic) id context; // 调用方可以使用的上下文
/*!
* 创建一个MtopRequest
* @param apiName API名称
* @param apiVersion API版本
* @return
* MtopRequest
*/
- (TBSDKRequest*) initWithApiName: (NSString*) apiName apiVersion: (NSString*) apiVersion;
/*!
* 添加一个http请求头
* @param value HTTP头value
* @param key HTTP头key
*/
- (void) addHttpHeader: (NSString*) value forKey: (NSString*) key;
/*!
* 添加一个协议参数
* @param value 参数值
* @param key 参数名
*/
- (void) addProtocolParameter: (NSString*) value forKey: (NSString*) key;
/*!
* 添加一个扩展参数和data参数平级
* @param value 参数值
* @param key 参数名
*/
- (void) addExtParameter: (id) value forKey: (NSString*) key;
/*!
* 移除一个扩展参数
* @param key
*/
- (void) removeExtParameter:(NSString*) key;
/*!
* 添加一个业务参数(业务级别参数)
* @param value 参数值
* @param key 参数名
*/
- (void) addBizParameter: (id) value forKey: (NSString*) key;
/*!
* 移除一个业务参数
* @param key
*/
- (void) removeBizParameter:(NSString*) key;
/*!
* 添加要上传的文件
* @param data 文件数据
* @param fileName 本地文件名(全路径)
* @param forKey form field 的 key
*
*/
- (void) addUploadFileWithData: (NSData*) data fileName: (NSString*) fileName forKey: (NSString*) key;
//! 取消TBSDK中的所有的网络连接
+ (void)cancelTBSDKAllRequest;
//! 开始同步网络请求, 当网络请求完成或失败后返回
- (BOOL)startSynchronous;
//! 开始异步请求
- (void)startAsynchronous;
//! 退出网路请求,并把delegate设置为空
- (void)cancelRequest;
/*!
* 重置
*/
- (void) reset;
@end
@@ -0,0 +1,47 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-1-30.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import "TBSDKRequest.h"
@protocol TBSDKRequestDelegate <NSObject>
@optional
- (void)requestStarted:(TBSDKRequest *)request;
- (void)request:(TBSDKRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders;
- (void)requestFinished:(TBSDKRequest *)request;
- (void)requestFailed:(TBSDKRequest *)request;
- (void)request:(TBSDKRequest *)request didReceiveData:(NSData *)data;
- (void)request:(TBSDKRequest *)request didLoadCacheResponseHeader:(NSDictionary *)responseHeader body:(NSString *)responseString;
- (NSArray *)requestSaveCache:(TBSDKRequest *)request responseHeader:(NSDictionary *)responseHeader body:(NSString *)responseDataString;
@end
@protocol TBSDKRequestDataSource <NSObject>
@required
- (NSURL *)requestURL;
@optional
- (NSDictionary *)requestPostValue;
- (BOOL)reuquestIsPost;
- (NSArray *)requestPostData;
- (NSDictionary *)httpRequestHeader;
@end
@@ -0,0 +1,40 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-7-10.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@class TBSDKRequest;
@protocol TBSDKRequestProgressProtocol <NSObject>
@optional
- (void)setProgress:(float)newProgress;
// Called when the request receives some data - bytes is the length of that data
- (void)request:(TBSDKRequest *)request didReceiveBytes:(long long)bytes;
// Called when the request sends some data
// The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
// bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
- (void)request:(TBSDKRequest *)request didSendBytes:(long long)bytes;
// Called when a request needs to change the length of the content to download
- (void)request:(TBSDKRequest *)request incrementDownloadSizeBy:(long long)newLength;
// Called when a request needs to change the length of the content to upload
// newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
- (void)request:(TBSDKRequest *)request incrementUploadSizeBy:(long long)newLength;
@end
@@ -0,0 +1,32 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-6-26.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBSDKSendFileObject : NSObject
@property (nonatomic, strong) NSData* data;
@property (nonatomic, strong) NSString* fileName;
@property (nonatomic, strong) NSString* key;
/*!
* 初始化一个文件上传对象
* @param data 文件数据
* @param fileName 本地文件名
* @param forKey form field key
* @return
* TBSDKSendFileObject
*/
- (TBSDKSendFileObject*) initWithData: (NSData*) data fileName: (NSString*) fileName forKey: (NSString*) key;
@end
@@ -0,0 +1,32 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-1-30.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import "TBSDKServerQueue.h"
@protocol TBSDKRequestQueueProtocol;
/** 定义了TBSDKServerQueue的私有方法
*
* 定义了TBSDKServerQueue的私有方法,对外不可见,只提供TBSDK内部调用
* 外部调用可能产生不安全的行为。
*/
@interface TBSDKServerQueue (Private)
//! 添加一个TBSDKServer到请求队列
- (void)addRequest:(id<TBSDKRequestQueueProtocol>)request;
//! 从请求队列中删除一个TBSDKServer。
- (void)removeRequest:(id<TBSDKRequestQueueProtocol>)request;
@end
@@ -0,0 +1,45 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-1-28.
// Copyright (c) 2013年 Taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
/** TBSDK的请求池。
*
* TBSDK的请求池,是单例模式。保存了TBSDK的所有的网络请求
* 用户可以获取获取自己的网络请求,而不需要将网络请求保存为实例变量
*/
@interface TBSDKServerQueue : NSObject
+ (TBSDKServerQueue *)shareInstance;
//! 获取delegate_对应的符合TBSDKRequestQueueProtocol协议的对象。
- (NSArray *)getRequestForDelegate:(id)delegate_;
//! 退出符合TBSDKRequestQueueProtocol协议的对象的网络请求,并把符合TBSDKRequestQueueProtocol协议的对象的delegate设置为nil。
- (void)cancelRequestNetworkAndClearDelegateForDelegate:(id)delegate_;
@end
@protocol TBSDKRequestQueueProtocol <NSObject>
@required
- (void)clearDelegatesAndCancel;
@optional
@property (nonatomic, weak) id delegate;
@end
@@ -0,0 +1,23 @@
//
// TBThreadSafeMutableArry.h
// TBLocationFramework
//
// Created by striveliu on 7/4/14.
// Copyright (c) 2014 taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <pthread.h>
@interface TBSDKThreadSafeMutableArry : NSArray
{
pthread_rwlock_t s_pthread_rwlock_t;
NSMutableArray *_mutableArry;
}
- (void)addObject:(id)anObject;
- (void) insert: (id) object atIndex: (NSUInteger) atIndex;
- (void)removeObjectAtIndex:(NSUInteger)index;
- (void)removeAllObjects;
- (void)removeLastObject;
- (id)objectAtIndex:(NSUInteger)index;
- (NSUInteger)getCount;
@end
@@ -0,0 +1,13 @@
//
// TBSDKThreadSafeMutableDictionary.h
// TBSDKNetworkSDK
//
// Created by Roger.Mu on 6/30/14.
// Copyright (c) 2014 Alibaba-Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBSDKThreadSafeMutableDictionary : NSMutableDictionary
@end
@@ -0,0 +1,59 @@
//
// NWURLConnectionOperation.h
// ALINetworkSDK
//
// Created by Roger.Mu on 5/11/15.
// Copyright (c) 2015 Taobao.com. All rights reserved.
//
typedef NS_ENUM(NSInteger, AFOperationState) {
TBSDKOperationPausedState = -1,
TBSDKOperationReadyState = 1,
TBSDKOperationExecutingState = 2,
TBSDKOperationFinishedState = 3,
};
typedef NSURLRequest *(^TBSDKURLConnectionOperationRedirectResponseBlock)(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *redirectResponse);
@interface TBSDKURLConnectionOperation : NSOperation <NSURLConnectionDelegate, NSURLConnectionDataDelegate, NSCopying>
// properties
@property (readonly, nonatomic, strong) NSURLRequest *request;
@property (readonly, nonatomic, strong) NSURLResponse *response;
@property (readonly, nonatomic, strong) NSData *responseData;
@property (nonatomic, copy) NSString *responseString;
@property (nonatomic, strong) NSError *error;
@property (nonatomic, assign) NSStringEncoding responseStringEncoding;
@property (readwrite, nonatomic, assign) long long totalBytesRead;
@property (nonatomic, strong) NSURLConnection *connection;
@property (nonatomic, strong) NSRecursiveLock *lock;
@property (nonatomic, strong) NSOutputStream *outputStream;
@property (nonatomic, strong) NSSet *runLoopModes;
@property (nonatomic, assign) AFOperationState state;
// block methods poperty
@property (readwrite, nonatomic, copy) TBSDKURLConnectionOperationRedirectResponseBlock redirectResponse;
// upload and download process
@property (readwrite, nonatomic, copy) void (^uploadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected);
@property (readwrite, nonatomic, copy) void (^downloadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected);
// methods
-(instancetype) initWithRequest: (NSURLRequest *) urlRequest;
// block methods
- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block;
- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block;
- (void)setRedirectResponseBlock:(NSURLRequest * (^)(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *redirectResponse))block;
//由于NSURLProtocol有限制,didReceiveResponse方法在内部第二次重试的时候不会收到,因此这里手动通知
- (void)connection:(NSURLConnection __unused *)connection didReceiveResponseWhenEncounterError:(NSURLResponse *)response;
@end
@interface TBSDKRequestDelegate : NSObject
@property (nonatomic, weak) TBSDKURLConnectionOperation *weakConnection;
@end
@@ -0,0 +1,39 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 iTeam on 13-2-24.
// Copyright (c) 2013年 亿刀/禚来强 iTeam. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol TBSDKErrorRule;
//TBSDKServer的私有方法定义
@protocol TBSDSKServerRule <NSObject>
@optional
- (void)setApiMethod:(NSString *)apiMethod;
- (void)setTbsdkError:(id<TBSDKErrorRule>)error;
- (void)setResponseData:(NSData *)responseData;
//! 网络请求开始
- (void)performDelegatStartSelector;
//! 网络请求成功
- (void)performDelegatSuccessSelector;
//! 网络请求失败
- (void)performDelegatFailSelector;
//!响应头下载完毕
- (void)performReciveResponseHeaders:(NSDictionary *)responseHeaders;
@end
@@ -0,0 +1,49 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by 亿刀/禚来强 on 13-7-31.
// Copyright (c) 2013年 亿刀/禚来强. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBSDkSignUtility : NSObject
+ (TBSDkSignUtility *)shareInstance;
+ (NSString *)getMtopSignWithAppkey:(NSString *)appkey
withApiName:(NSString *)apiName
withApiVersion:(NSString *)apiVersion
withData:(NSDictionary *)data
withHeader:(NSDictionary *)headers;
/*!
* 用sercet md5字符串value
* @param value
* @return
* MD5
*/
+ (NSString*) md5: (NSString*) appkey value: (NSString*) value;
+ (NSString*) md5: (NSString*) value;
/*!
*
*
*
*/
- (void) removeSecurity: (NSString*) key;
/*!
*
*
*
*/
- (void) addSecurity: (NSString*) key;
@end
@@ -0,0 +1,42 @@
// '########'########::'######:'########:'##:::'##:
// ... ##..::##.... ##'##... ##:##.... ##:##::'##::
// ::: ##::::##:::: ##:##:::..::##:::: ##:##:'##:::
// ::: ##::::########:. ######::##:::: ##:#####::::
// ::: ##::::##.... ##:..... ##:##:::: ##:##. ##:::
// ::: ##::::##:::: ##'##::: ##:##:::: ##:##:. ##::
// ::: ##::::########:. ######::########::##::. ##:
// :::..::::........:::......::........::..::::..::
//
// Created by Georg Kitz on 20.08.11.
// Copyright 2011 Aurora Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIDevice(TBNewSDKIdentifierAddition)
+ (NSString *)tbsdkPlatform;
+ (NSString *)tbsdkMacaddress;
/*
* @method uniqueDeviceIdentifier
* @description use this method when you need a unique identifier in one app.
* It generates a hash from the MAC-address in combination with the bundle identifier
* of your app.
*/
- (NSString *)tbsdkUniqueDeviceIdentifier;
/*
* @method uniqueGlobalDeviceIdentifier
* @description use this method when you need a unique global identifier to track a device
* with multiple apps. as example a advertising network will use this method to track the device
* from different apps.
* It generates a hash from the MAC-address only.
*/
- (NSString *)tbsdkUniqueGlobalDeviceIdentifier;
@end
@@ -0,0 +1,33 @@
Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '5.0'
s.name = 'OpenMtopSDK'
s.version = "1.6.1.17-SNAPSHOT"
s.summary = '淘宝MTOPSDK'
s.description = 'MTOP SDK for IOS'
s.homepage = 'http://gitlab.alibaba-inc.com/wireless/mtopsdk'
s.license = {
:type => 'Copyright',
:text => <<-LICENSE
Alibaba-Inc copyright
LICENSE
}
s.requires_arc = true
s.authors = {'苍至'=>'silu.msl@taobao.com'}
s.frameworks = 'UIKit', 'Foundation'
s.dependency 'UTDID'
s.dependency 'UTDID'
s.dependency 'SecurityGuardSDK'
s.dependency 'SGMain'
s.dependency 'SGSecurityBody'
s.dependency 'SGNoCaptcha'
s.source = { :git=>"git@gitlab.alibaba-inc.com:wireless/opensdk.git", :commit=> "d81fd09" }
#s.exclude_files = exclude_files+networksdk_no_arc_files
s.source_files = 'MtopSDK/*.{h,m,c,mm}'
end