Commit d9bd7957171be244f7e07a5968bfa9d98c421a75
1 parent
e68ce758
no message
Showing
3 changed files
with
9 additions
and
38 deletions
CNLiveEnvironment/Classes/CNLiveEnvironmentManager.m
| ... | ... | @@ -79,6 +79,7 @@ |
| 79 | 79 | @end |
| 80 | 80 | |
| 81 | 81 | @implementation CNLiveEnvironmentManager |
| 82 | +static CNLiveEnvironmentManager *_instance = nil; | |
| 82 | 83 | |
| 83 | 84 | /** |
| 84 | 85 | * 默认是测试商店版 |
| ... | ... | @@ -100,12 +101,11 @@ |
| 100 | 101 | * @abstract 单例初始化 |
| 101 | 102 | */ |
| 102 | 103 | + (instancetype)manager{ |
| 103 | - static CNLiveEnvironmentManager *manager = nil; | |
| 104 | 104 | static dispatch_once_t once; |
| 105 | 105 | dispatch_once(&once, ^{ |
| 106 | - manager = [[CNLiveEnvironmentManager alloc]init]; | |
| 106 | + _instance = [[CNLiveEnvironmentManager alloc]init]; | |
| 107 | 107 | }); |
| 108 | - return manager; | |
| 108 | + return _instance; | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| ... | ... | @@ -117,6 +117,9 @@ |
| 117 | 117 | */ |
| 118 | 118 | + (void)setEnvironment:(CNLiveEnvironmentType)isEnvironment{ |
| 119 | 119 | CNLiveEnvironmentManager *manager = [CNLiveEnvironmentManager manager]; |
| 120 | + if(manager.isEnvironment == isEnvironment){ | |
| 121 | + return; | |
| 122 | + } | |
| 120 | 123 | manager.isEnvironment = isEnvironment; |
| 121 | 124 | switch (isEnvironment) { |
| 122 | 125 | #pragma mark - 测试企业环境 | ... | ... |
Example/CNLiveEnvironment/XWAppDelegate.m
| ... | ... | @@ -13,37 +13,6 @@ |
| 13 | 13 | |
| 14 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 15 | 15 | { |
| 16 | - // Override point for customization after application launch. | |
| 17 | -// NSLog(@"%@",EnvironmentDesc); | |
| 18 | -// NSLog(@"%@",ShareSDKAppId_Share); | |
| 19 | -// NSLog(@"%d",TestEnvironment); | |
| 20 | -// NSLog(@"%@",cn_API_Host(@"asd")); | |
| 21 | -// NSLog(@"%@",AppId); | |
| 22 | -// NSLog(@"%@",APPKey); | |
| 23 | -// NSLog(@"%@",CNStockDarenVideoCallBackUrl); | |
| 24 | -// NSLog(@"%@",CNGetWitnessCancelCollection); | |
| 25 | - NSLog(@"%@",cn_API_Host(@"/我爱中国")); | |
| 26 | - | |
| 27 | - [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; | |
| 28 | -// NSLog(@"%@",EnvironmentDesc); | |
| 29 | -// NSLog(@"%@",ShareSDKAppId_Share); | |
| 30 | -// NSLog(@"%d",TestEnvironment); | |
| 31 | -// NSLog(@"%@",cn_API_Host(@"asd")); | |
| 32 | -// NSLog(@"%@",AppId); | |
| 33 | -// NSLog(@"%@",APPKey); | |
| 34 | -// NSLog(@"%@",CNStockDarenVideoCallBackUrl); | |
| 35 | -// NSLog(@"%@",CNGetWitnessCancelCollection); | |
| 36 | - NSLog(@"%@",cn_API_Host(@"/我爱中国")); | |
| 37 | - | |
| 38 | - | |
| 39 | - | |
| 40 | - [CNLiveEnvironmentManager setEnvironment:CNLiveDebugInHouse]; | |
| 41 | -// NSLog(@"%@",EnvironmentDesc); | |
| 42 | -// NSLog(@"%@",ShareSDKAppId_Share); | |
| 43 | -// NSLog(@"%d",TestEnvironment); | |
| 44 | -// NSLog(@"%@",API_Host(@"asd")); | |
| 45 | - NSLog(@"%@",CNStockDarenVideoCallBackUrl); | |
| 46 | - NSLog(@"%@",CNGetWitnessCancelCollection); | |
| 47 | 16 | |
| 48 | 17 | return YES; |
| 49 | 18 | } | ... | ... |
Example/CNLiveEnvironment/XWViewController.m
| ... | ... | @@ -19,12 +19,11 @@ |
| 19 | 19 | { |
| 20 | 20 | [super viewDidLoad]; |
| 21 | 21 | // Do any additional setup after loading the view, typically from a nib. |
| 22 | + NSLog(@"%@",TIM_GetTokenUrl); | |
| 23 | + [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; | |
| 22 | 24 | [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; |
| 23 | - NSLog(@"%@",CNStockDarenVideoCallBackUrl); | |
| 24 | - NSLog(@"%@",CNGetWitnessCancelCollection); | |
| 25 | - NSLog(@"%@",NetAddShareImgUrl); | |
| 25 | + [CNLiveEnvironmentManager setEnvironment:CNLiveDebugInHouse]; | |
| 26 | 26 | |
| 27 | - | |
| 28 | 27 | NSLog(@"%@",TIM_GetTokenUrl); |
| 29 | 28 | |
| 30 | 29 | ... | ... |