Skip to content

Commit fd8c7b7

Browse files
author
man.li
committed
no message
1 parent f3e1eb7 commit fd8c7b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4215
-2945
lines changed

Example_Objc.xcodeproj/project.pbxproj

Lines changed: 1223 additions & 1195 deletions
Large diffs are not rendered by default.

Example_Objc/AppDelegate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "AppDelegate.h"
10-
//#import "Example_Objc-Swift.h"
10+
#import "Example_Objc-Swift.h"
1111

1212
@interface AppDelegate ()
1313

@@ -26,7 +26,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2626
// CocoaDebug.emailToRecipients = @[@"aaa@gmail.com", @"bbb@gmail.com"]; //default value is `nil`
2727
// CocoaDebug.emailCcRecipients = @[@"ccc@gmail.com", @"ddd@gmail.com"]; //default value is `nil`
2828
// CocoaDebug.mainColor = @"#fd9727"; //default value is `#42d459`
29-
// [CocoaDebug enable];
29+
[CocoaDebug enable];
3030
#endif
3131

3232
return YES;

Example_Objc/PrefixHeader.pch

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
////
2-
//// Example
3-
//// man
4-
////
5-
//// Created by man on 11/11/2018.
6-
//// Copyright © 2018 man. All rights reserved.
7-
////
8-
//
9-
//#import "_ObjcLog.h"
10-
//
11-
//
12-
//
13-
///**
14-
// * 日志颜色
15-
// * Unicode转中文
16-
// * 以上2个特征可以自己定制
17-
// */
18-
//#ifdef DEBUG
19-
// //black color
20-
// #define NSLog(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor blackColor] unicodeToChinese:NO message:(fmt), ##__VA_ARGS__]
21-
// #define NSLog_UNICODE(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor blackColor] unicodeToChinese:YES message:(fmt), ##__VA_ARGS__]
22-
// //red color
23-
// #define RedLog(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor redColor] unicodeToChinese:NO message:(fmt), ##__VA_ARGS__]
24-
// #define RedLog_UNICODE(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor redColor] unicodeToChinese:YES message:(fmt), ##__VA_ARGS__]
25-
//#else
26-
// //black color
27-
// #define NSLog(fmt, ...) nil
28-
// #define NSLog_UNICODE(fmt, ...) nil
29-
// //red color
30-
// #define RedLog(fmt, ...) nil
31-
// #define RedLog_UNICODE(fmt, ...) nil
32-
//#endif
331
//
2+
// Example
3+
// man
344
//
5+
// Created by man on 11/11/2018.
6+
// Copyright © 2018 man. All rights reserved.
357
//
8+
9+
#import "_ObjcLog.h"
10+
11+
12+
13+
/**
14+
* 日志颜色
15+
* Unicode转中文
16+
* 以上2个特征可以自己定制
17+
*/
18+
#ifdef DEBUG
19+
//white color
20+
#define NSLog(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor whiteColor] unicodeToChinese:NO message:(fmt), ##__VA_ARGS__]
21+
#define NSLog_UNICODE(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor whiteColor] unicodeToChinese:YES message:(fmt), ##__VA_ARGS__]
22+
//red color
23+
#define RedLog(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor redColor] unicodeToChinese:NO message:(fmt), ##__VA_ARGS__]
24+
#define RedLog_UNICODE(fmt, ...) [_ObjcLog logWithFile:__FILE__ function:__FUNCTION__ line:__LINE__ color:[UIColor redColor] unicodeToChinese:YES message:(fmt), ##__VA_ARGS__]
25+
#else
26+
//white color
27+
#define NSLog(fmt, ...) nil
28+
#define NSLog_UNICODE(fmt, ...) nil
29+
//red color
30+
#define RedLog(fmt, ...) nil
31+
#define RedLog_UNICODE(fmt, ...) nil
32+
#endif
33+
34+
35+

Example_Objc/ViewController.m

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,21 @@
1010
#import "AFURLSessionManager.h"
1111
#import <WebKit/WebKit.h>
1212
#import "_TCPLogger.h"
13-
#import "Example_Objc-Swift.h"
1413

1514
@interface ViewController ()
1615

1716
@end
1817

1918
@implementation ViewController
2019

21-
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
22-
#ifdef DEBUG
23-
[CocoaDebug presentWithFatherController:self index:0];
24-
#endif
25-
}
26-
2720
- (void)viewDidLoad {
2821
[super viewDidLoad];
2922

3023
NSLog(@"hello world");
31-
NSLog(@"hello world red");
32-
NSLog(@"hello world yellow");
24+
RedLog(@"hello world red");
25+
RedLog(@"hello world yellow");
3326
NSLog(@"%d", 6666666);
34-
NSLog(@"unicode转换为中文");
27+
NSLog_UNICODE(@"unicode转换为中文");
3528

3629
[self testHTTP];
3730
[self test_console_WKWebView];
@@ -61,10 +54,10 @@ - (void)testHTTP {
6154
} downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
6255
} completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
6356
if (error) {
64-
NSLog(@"%@", error.localizedDescription);
57+
NSLog(error.localizedDescription);
6558
} else {
66-
NSLog(@"%@",response);
67-
NSLog(@"%@", responseObject);
59+
RedLog(@"%@",response);
60+
NSLog(responseObject);
6861
}
6962
}];
7063
[dataTask resume];
@@ -78,9 +71,9 @@ - (void)testHTTP {
7871
NSData *responseData = [NSURLConnection sendSynchronousRequest:dataRqst returningResponse:&response error:&error];
7972
NSString *responseString = [[NSString alloc] initWithBytes:[responseData bytes] length:[responseData length] encoding:NSUTF8StringEncoding];
8073
if (error) {
81-
NSLog(@"%@", error.localizedDescription);
74+
NSLog(error.localizedDescription);
8275
}else{
83-
NSLog(@"%@", responseString);
76+
NSLog(responseString);
8477
}
8578
});
8679

@@ -95,7 +88,7 @@ - (void)testHTTP {
9588
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
9689
NSLog(@"%@",responseDictionary);
9790
}else{
98-
NSLog(@"%@", error.localizedDescription);
91+
NSLog(error.localizedDescription);
9992
}
10093
}];
10194
[dataTask_ resume];

0 commit comments

Comments
 (0)