Commit 1fdbff7a3ac360de4edcf87f9658105fd1fd4880
1 parent
441b6f6a
no message
Showing
4 changed files
with
16 additions
and
5 deletions
CNLivePlayer/Classes/Database/CNLivePlayerDBTool.m
| @@ -68,6 +68,8 @@ | @@ -68,6 +68,8 @@ | ||
| 68 | } else { | 68 | } else { |
| 69 | NSLog(@"建表成功"); | 69 | NSLog(@"建表成功"); |
| 70 | } | 70 | } |
| 71 | + [db close]; | ||
| 72 | + | ||
| 71 | }]; | 73 | }]; |
| 72 | 74 | ||
| 73 | } | 75 | } |
| @@ -80,6 +82,8 @@ | @@ -80,6 +82,8 @@ | ||
| 80 | while ([re next]) { | 82 | while ([re next]) { |
| 81 | isResult = YES; | 83 | isResult = YES; |
| 82 | } | 84 | } |
| 85 | + [db close]; | ||
| 86 | + | ||
| 83 | }]; | 87 | }]; |
| 84 | return isResult; | 88 | return isResult; |
| 85 | 89 | ||
| @@ -94,7 +98,8 @@ | @@ -94,7 +98,8 @@ | ||
| 94 | model = [[CNLivePlayerDBModel alloc] initWithContenId:[rs stringForColumn:@"contentId"] url:[rs stringForColumn:@"url"]]; | 98 | model = [[CNLivePlayerDBModel alloc] initWithContenId:[rs stringForColumn:@"contentId"] url:[rs stringForColumn:@"url"]]; |
| 95 | model.finish = [rs boolForColumn:@"finish"]; | 99 | model.finish = [rs boolForColumn:@"finish"]; |
| 96 | } | 100 | } |
| 97 | - | 101 | + [db close]; |
| 102 | + | ||
| 98 | }]; | 103 | }]; |
| 99 | return model; | 104 | return model; |
| 100 | 105 | ||
| @@ -113,6 +118,8 @@ | @@ -113,6 +118,8 @@ | ||
| 113 | [self openDB:^(int result, FMDatabase *db) { | 118 | [self openDB:^(int result, FMDatabase *db) { |
| 114 | NSString * check = [NSString stringWithFormat:@"UPDATE DATATABLE SET finish = 1 where contentId = '%@'",contentId]; | 119 | NSString * check = [NSString stringWithFormat:@"UPDATE DATATABLE SET finish = 1 where contentId = '%@'",contentId]; |
| 115 | isResult = [db executeUpdate:check]; | 120 | isResult = [db executeUpdate:check]; |
| 121 | + [db close]; | ||
| 122 | + | ||
| 116 | }]; | 123 | }]; |
| 117 | return isResult; | 124 | return isResult; |
| 118 | 125 | ||
| @@ -130,6 +137,7 @@ | @@ -130,6 +137,7 @@ | ||
| 130 | isResult = YES; | 137 | isResult = YES; |
| 131 | } | 138 | } |
| 132 | } | 139 | } |
| 140 | + [db close]; | ||
| 133 | 141 | ||
| 134 | }]; | 142 | }]; |
| 135 | return isResult; | 143 | return isResult; |
| @@ -144,6 +152,7 @@ | @@ -144,6 +152,7 @@ | ||
| 144 | if (res) { | 152 | if (res) { |
| 145 | isResult = YES; | 153 | isResult = YES; |
| 146 | } | 154 | } |
| 155 | + [db close]; | ||
| 147 | 156 | ||
| 148 | }]; | 157 | }]; |
| 149 | return isResult; | 158 | return isResult; |
| @@ -162,7 +171,8 @@ | @@ -162,7 +171,8 @@ | ||
| 162 | model.finish = [rs boolForColumn:@"finish"]; | 171 | model.finish = [rs boolForColumn:@"finish"]; |
| 163 | [list addObject:model]; | 172 | [list addObject:model]; |
| 164 | } | 173 | } |
| 165 | - | 174 | + [db close]; |
| 175 | + | ||
| 166 | }]; | 176 | }]; |
| 167 | return list; | 177 | return list; |
| 168 | } | 178 | } |
| @@ -181,7 +191,8 @@ | @@ -181,7 +191,8 @@ | ||
| 181 | if (res) { | 191 | if (res) { |
| 182 | isResult = YES; | 192 | isResult = YES; |
| 183 | } | 193 | } |
| 184 | - | 194 | + [db close]; |
| 195 | + | ||
| 185 | }]; | 196 | }]; |
| 186 | return isResult; | 197 | return isResult; |
| 187 | 198 |
CNLivePlayer/Classes/Download/CNLiveHTTPProxyService.m
| @@ -89,6 +89,7 @@ | @@ -89,6 +89,7 @@ | ||
| 89 | 89 | ||
| 90 | - (void)deleteAllCachesWithError:(NSError *__autoreleasing *)error { | 90 | - (void)deleteAllCachesWithError:(NSError *__autoreleasing *)error { |
| 91 | [[KSYHTTPProxyService sharedInstance] deleteAllCachesWithError:error]; | 91 | [[KSYHTTPProxyService sharedInstance] deleteAllCachesWithError:error]; |
| 92 | + //清空数据缓存 | ||
| 92 | [[CNLivePlayerDBTool shared] clearTable]; | 93 | [[CNLivePlayerDBTool shared] clearTable]; |
| 93 | } | 94 | } |
| 94 | 95 |
CNLivePlayer/Classes/Player/CNLivePlayer.m
| @@ -47,7 +47,6 @@ | @@ -47,7 +47,6 @@ | ||
| 47 | @end | 47 | @end |
| 48 | 48 | ||
| 49 | @implementation CNLivePlayer | 49 | @implementation CNLivePlayer |
| 50 | -#pragma mark - 通知 | ||
| 51 | //收到消息通知 | 50 | //收到消息通知 |
| 52 | NSString * const CNLivePlayerMsgReceiveNotification = @"CNLiveMsgToolsPlayerReceiveNotification"; | 51 | NSString * const CNLivePlayerMsgReceiveNotification = @"CNLiveMsgToolsPlayerReceiveNotification"; |
| 53 | //获取主播状态通知 | 52 | //获取主播状态通知 |
Example/CNLivePlayer/CNLiveAppDelegate.m
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 19 | { | 19 | { |
| 20 | // Override point for customization after application launch. | 20 | // Override point for customization after application launch. |
| 21 | - [CNLivePlayerManager setAppId:CNLivePlayer_AppId appKey:CNLivePlayer_AppKey isTestEnvironment:NO]; | 21 | + [CNLivePlayerManager setAppId:CNLivePlayer_AppId appKey:CNLivePlayer_AppKey isTestEnvironment:YES]; |
| 22 | 22 | ||
| 23 | return YES; | 23 | return YES; |
| 24 | } | 24 | } |