1
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
self.title = KBLocalized(@"lang_test_title");
|
||||
NSString *code = [KBLocalizationManager shared].currentLanguageCode ?: @"";
|
||||
NSString *fmt = KBLocalized(@"current_lang");
|
||||
NSString *fallback = KBLocalized(@"当前:%@");
|
||||
NSString *fallback = KBLocalized(@"Current: %@");
|
||||
self.label.text = [NSString stringWithFormat:fmt.length ? fmt : fallback, code];
|
||||
[self.toggleBtn setTitle:KBLocalized(@"lang_toggle") forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
#if DEBUG
|
||||
// 打印请求信息(GET)
|
||||
NSString *paramStr = [self kb_prettyJSONStringFromObject:parameters] ?: @"(null)";
|
||||
KBLOG(@"HTTP GET\nURL: %@\nHeaders: %@\n参数: %@",
|
||||
KBLOG(@"HTTP GET\nURL: %@\nHeaders: %@\nParams: %@",
|
||||
req.URL.absoluteString,
|
||||
req.allHTTPHeaderFields ?: @{},
|
||||
paramStr);
|
||||
@@ -397,7 +397,7 @@ autoShowBusinessError:YES
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
NSInteger status = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).statusCode : 0;
|
||||
KBLOG(@"请求失败\nURL: %@\n状态: %ld\n错误: %@\nUserInfo: %@",
|
||||
KBLOG(@"Request failed\nURL: %@\nStatus: %ld\nError: %@\nUserInfo: %@",
|
||||
req.URL.absoluteString,
|
||||
(long)status,
|
||||
error.localizedDescription,
|
||||
@@ -409,7 +409,7 @@ autoShowBusinessError:YES
|
||||
NSData *data = (NSData *)responseObject;
|
||||
if (![data isKindOfClass:[NSData class]]) {
|
||||
#if DEBUG
|
||||
KBLOG(@"无效响应\nURL: %@\n说明: %@", req.URL.absoluteString, KBLocalized(@"No data received"));
|
||||
KBLOG(@"Invalid response\nURL: %@\nReason: %@", req.URL.absoluteString, KBLocalized(@"No data received"));
|
||||
#endif
|
||||
if (completion) completion(nil, response, [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorInvalidResponse userInfo:@{NSLocalizedDescriptionKey:KBLocalized(@"No data")}]);
|
||||
return;
|
||||
@@ -436,7 +436,7 @@ autoShowBusinessError:YES
|
||||
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonErr];
|
||||
if (jsonErr) {
|
||||
#if DEBUG
|
||||
KBLOG(@"响应解析失败(JSON)\nURL: %@\n错误: %@",
|
||||
KBLOG(@"Response decode failed (JSON)\nURL: %@\nError: %@",
|
||||
req.URL.absoluteString,
|
||||
jsonErr.localizedDescription);
|
||||
#endif
|
||||
@@ -453,7 +453,7 @@ autoShowBusinessError:YES
|
||||
NSString *pretty = [self kb_prettyJSONStringFromObject:json] ?: @"(null)";
|
||||
pretty = [self kb_trimmedString:pretty maxLength:4096];
|
||||
NSInteger status = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).statusCode : 0;
|
||||
KBLOG(@"\n[KBNetwork] 响应成功(JSON)\nURL: %@\n状态: %ld\nContent-Type: %@\n数据: %@\n",
|
||||
KBLOG(@"Response OK (JSON)\nURL: %@\nStatus: %ld\nContent-Type: %@\nData: %@",
|
||||
req.URL.absoluteString,
|
||||
(long)status,
|
||||
ct ?: @"",
|
||||
|
||||
Reference in New Issue
Block a user