Commit 9c9e48b4618af4b2b93e08ae7756ac52f88f4bee

Authored by 张旭
1 parent 7a2219e7

修改文档token30天失效

CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserManager.m
@@ -10,6 +10,9 @@ @@ -10,6 +10,9 @@
10 #import "CNLiveUserSystemTools.h" 10 #import "CNLiveUserSystemTools.h"
11 #import "Common.h" 11 #import "Common.h"
12 12
  13 +#define testStatUrl @"http://testappsta.cnlive.com/app.js"
  14 +#define formalStatUrl @"http://app.sta.cnlive.com/app.js"
  15 +
13 @interface CNLiveUserManager () 16 @interface CNLiveUserManager ()
14 { 17 {
15 NSDate *_startDate; 18 NSDate *_startDate;
@@ -45,8 +48,8 @@ @@ -45,8 +48,8 @@
45 48
46 NSString *stamp = realTime; 49 NSString *stamp = realTime;
47 stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; 50 stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""];
48 -  
49 - NSString *vvUrl = [NSString stringWithFormat:@"http://app.sta.cnlive.com/app.js?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1300&uri=&sid=&plat=i_%@&objid=",kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion, StatAppVersion]; 51 + NSString *baseUrl = self.isTestEnvironment ? formalStatUrl : testStatUrl;
  52 + NSString *vvUrl = [NSString stringWithFormat:@"%@?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1300&uri=&sid=&plat=i_%@&objid=",baseUrl,kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion, StatAppVersion];
50 53
51 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil]; 54 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil];
52 55
@@ -62,8 +65,8 @@ @@ -62,8 +65,8 @@
62 65
63 NSString *endDate = [NSString stringWithFormat:@"%.3f",[netDate timeIntervalSinceDate:_startDate]]; 66 NSString *endDate = [NSString stringWithFormat:@"%.3f",[netDate timeIntervalSinceDate:_startDate]];
64 endDate = [endDate stringByReplacingOccurrencesOfString:@"." withString:@""]; 67 endDate = [endDate stringByReplacingOccurrencesOfString:@"." withString:@""];
65 -  
66 - NSString *vvUrl = [NSString stringWithFormat:@"http://app.sta.cnlive.com/app.js?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1311&uri=%@&sid=&plat=i_%@&objid=",kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion,endDate,StatAppVersion]; 68 + NSString *baseUrl = self.isTestEnvironment ? formalStatUrl : testStatUrl;
  69 + NSString *vvUrl = [NSString stringWithFormat:@"%@?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1311&uri=%@&sid=&plat=i_%@&objid=",baseUrl,kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion,endDate,StatAppVersion];
67 70
68 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil]; 71 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil];
69 }]; 72 }];
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
@@ -17,15 +17,25 @@ @@ -17,15 +17,25 @@
17 @param appId 注册成功获得应用ID 17 @param appId 注册成功获得应用ID
18 @param appKey 注册成功获得应用key 18 @param appKey 注册成功获得应用key
19 @param appSecret 注册成功获得应用secret 19 @param appSecret 注册成功获得应用secret
  20 + @param isTestEnvironment 测试环境开关
20 @warning 必传参数 21 @warning 必传参数
21 - 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用 22 + 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用
  23 + */
  24 + + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment;
  25 +
  26 +/**
  27 + @abstract 初始化
  28 + @param appId 注册成功获得应用ID
  29 + @param appKey 注册成功获得应用key
  30 + @param appSecret 注册成功获得应用secret
  31 + @warning 必传参数
  32 + 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用
22 *此方法环境默认为正式环境,建议使用如下方法初始化. 33 *此方法环境默认为正式环境,建议使用如下方法初始化.
23 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment; 34 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment;
24 35
25 */ 36 */
26 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; 37 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret;
27 38
28 -  
29 /** 39 /**
30 @abstract 注册 40 @abstract 注册
31 @param userName 邮箱或手机 41 @param userName 邮箱或手机
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
@@ -31,24 +31,24 @@ @@ -31,24 +31,24 @@
31 [[CNLiveUserManager manager] addObserver]; 31 [[CNLiveUserManager manager] addObserver];
32 } 32 }
33 33
34 -///**  
35 -// @abstract 初始化  
36 -// @param appId 注册成功获得应用ID  
37 -// @param appKey 注册成功获得应用key  
38 -// @param appSecret 注册成功获得应用secret  
39 -// @param isTestEnvironment 测试环境开关,YES为测试环境,NO为正式环境  
40 -// @warning 必传参数  
41 -// 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用  
42 -// */  
43 -//+ (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment  
44 -//{  
45 -// [CNLiveUserManager manager].appId = appId;  
46 -// [CNLiveUserManager manager].appKey = appKey;  
47 -// [CNLiveUserManager manager].appSecret = appSecret;  
48 -// [CNLiveUserManager manager].isTestEnvironment = isTestEnvironment;  
49 -//  
50 -// [[CNLiveUserManager manager] addObserver];  
51 -//} 34 +/**
  35 + @abstract 初始化
  36 + @param appId 注册成功获得应用ID
  37 + @param appKey 注册成功获得应用key
  38 + @param appSecret 注册成功获得应用secret
  39 + @param isTestEnvironment 测试环境开关,YES为测试环境,NO为正式环境
  40 + @warning 必传参数
  41 + 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用
  42 + */
  43 ++ (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment
  44 +{
  45 + [CNLiveUserManager manager].appId = appId;
  46 + [CNLiveUserManager manager].appKey = appKey;
  47 + [CNLiveUserManager manager].appSecret = appSecret;
  48 + [CNLiveUserManager manager].isTestEnvironment = isTestEnvironment;
  49 +
  50 + [[CNLiveUserManager manager] addObserver];
  51 +}
52 52
53 /** 53 /**
54 * 注册 54 * 注册
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemTools.m
@@ -12,6 +12,9 @@ @@ -12,6 +12,9 @@
12 #import "Common.h" 12 #import "Common.h"
13 #import "CNLiveUserManager.h" 13 #import "CNLiveUserManager.h"
14 14
  15 +#define testStatUrl @"http://testappsta.cnlive.com/app.js"
  16 +#define formalStatUrl @"http://app.sta.cnlive.com/app.js"
  17 +
15 @implementation CNLiveUserSystemTools 18 @implementation CNLiveUserSystemTools
16 19
17 #pragma mark - uuid 20 #pragma mark - uuid
@@ -111,7 +114,8 @@ @@ -111,7 +114,8 @@
111 [CNLiveUserSystemTools getRealTimeString:^(NSString * _Nullable realTime, NSDate * _Nullable netDate) { 114 [CNLiveUserSystemTools getRealTimeString:^(NSString * _Nullable realTime, NSDate * _Nullable netDate) {
112 NSString *stamp = realTime; 115 NSString *stamp = realTime;
113 stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; 116 stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""];
114 - NSString *vvUrl = [NSString stringWithFormat:@"http://app.sta.cnlive.com/app.js?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1000&uri=%@&sid=%@&plat=i_%@&objid=_", kSVer, [self uidForStat:realTime], stamp, [CNLiveUserManager manager].appId, SDKVersion, errorString,[self getSid],StatAppVersion]; 117 + NSString *baseUrl = self.isTestEnvironment ? formalStatUrl : testStatUrl;
  118 + NSString *vvUrl = [NSString stringWithFormat:@"%@?sver=%@&uid=%@&tm=%@&from=&spid=&appid=%@&version=1005_%@&eventid=1000&uri=%@&sid=%@&plat=i_%@&objid=_",baseUrl,kSVer, [self uidForStat:realTime], stamp, [CNLiveUserManager manager].appId, SDKVersion, errorString,[self getSid],StatAppVersion];
115 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil]; 119 [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil];
116 }]; 120 }];
117 } 121 }
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemCenter.h
@@ -17,12 +17,25 @@ @@ -17,12 +17,25 @@
17 @param appId 注册成功获得应用ID 17 @param appId 注册成功获得应用ID
18 @param appKey 注册成功获得应用key 18 @param appKey 注册成功获得应用key
19 @param appSecret 注册成功获得应用secret 19 @param appSecret 注册成功获得应用secret
  20 + @param isTestEnvironment 测试环境开关
  21 + @warning 必传参数
  22 + 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用
  23 + */
  24 + + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment;
  25 +
  26 +/**
  27 + @abstract 初始化
  28 + @param appId 注册成功获得应用ID
  29 + @param appKey 注册成功获得应用key
  30 + @param appSecret 注册成功获得应用secret
20 @warning 必传参数 31 @warning 必传参数
21 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用 32 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用
  33 + *此方法环境默认为正式环境,建议使用如下方法初始化.
  34 + + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment;
  35 +
22 */ 36 */
23 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; 37 + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret;
24 38
25 -  
26 /** 39 /**
27 @abstract 注册 40 @abstract 注册
28 @param userName 邮箱或手机 41 @param userName 邮箱或手机
iOS用户SDK.docx
No preview for this file type