Skip to content

Commit c706eb0

Browse files
committed
fix: 🐛 update NO.38 question
add demo for NO.38 ✅ Closes: ChenYilong#69 ChenYilong#47 ChenYilong#44
1 parent 0c70ee8 commit c706eb0

File tree

55 files changed

+366132
-81
lines changed

Some content is hidden

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

55 files changed

+366132
-81
lines changed

01《招聘一个靠谱的iOS》面试题参考答案/Deme_39_CYLSystemAPIMemoryLeak/Deme_39_CYLSystemAPIMemoryLeak.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
9A3CA841248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3CA840248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.m */; };
1011
9AD5C4742485167900704476 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD5C4732485167900704476 /* AppDelegate.m */; };
1112
9AD5C4772485167900704476 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD5C4762485167900704476 /* SceneDelegate.m */; };
1213
9AD5C47A2485167900704476 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD5C4792485167900704476 /* ViewController.m */; };
@@ -43,6 +44,8 @@
4344
/* End PBXContainerItemProxy section */
4445

4546
/* Begin PBXFileReference section */
47+
9A3CA83F248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CYLBaseViewController+CYLBaseViewControllerExtension.h"; sourceTree = "<group>"; };
48+
9A3CA840248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CYLBaseViewController+CYLBaseViewControllerExtension.m"; sourceTree = "<group>"; };
4649
9AD5C46F2485167900704476 /* Deme_39_CYLSystemAPIMemoryLeak.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Deme_39_CYLSystemAPIMemoryLeak.app; sourceTree = BUILT_PRODUCTS_DIR; };
4750
9AD5C4722485167900704476 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4851
9AD5C4732485167900704476 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -145,6 +148,8 @@
145148
9AD5C4B724851B8200704476 /* NSOperationQueueIVARBlock.m */,
146149
9AD5C4B92485273B00704476 /* CYLBaseViewController.h */,
147150
9AD5C4BA2485273C00704476 /* CYLBaseViewController.m */,
151+
9A3CA83F248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.h */,
152+
9A3CA840248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.m */,
148153
9AD5C47B2485167900704476 /* Main.storyboard */,
149154
9AD5C47E2485167D00704476 /* Assets.xcassets */,
150155
9AD5C4802485167D00704476 /* LaunchScreen.storyboard */,
@@ -311,6 +316,7 @@
311316
9AD5C4B524851B7600704476 /* NSOperationQueueBlock.m in Sources */,
312317
9AD5C4AF24851B5D00704476 /* NSNotificationCenterIVARBlock.m in Sources */,
313318
9AD5C4B224851B6900704476 /* GCDBlock.m in Sources */,
319+
9A3CA841248CE5960022276A /* CYLBaseViewController+CYLBaseViewControllerExtension.m in Sources */,
314320
9AD5C4B824851B8200704476 /* NSOperationQueueIVARBlock.m in Sources */,
315321
9AD5C4772485167900704476 /* SceneDelegate.m in Sources */,
316322
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// CYLBaseViewController+CYLBaseViewControllerExtension.h
3+
// Deme_39_CYLSystemAPIMemoryLeak
4+
//
5+
// Created by chenyilong on 2020/6/7.
6+
// Copyright © 2020 ChenYilong. All rights reserved.
7+
//
8+
9+
#import "CYLBaseViewController.h"
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface CYLBaseViewController (CYLBaseViewControllerExtension)
14+
15+
- (void)cyl_test;
16+
+ (void)cyl_testClass;
17+
18+
@end
19+
20+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// CYLBaseViewController+CYLBaseViewControllerExtension.m
3+
// Deme_39_CYLSystemAPIMemoryLeak
4+
//
5+
// Created by chenyilong on 2020/6/7.
6+
// Copyright © 2020 ChenYilong. All rights reserved.
7+
//
8+
9+
#import "CYLBaseViewController+CYLBaseViewControllerExtension.h"
10+
11+
@implementation CYLBaseViewController (CYLBaseViewControllerExtension)
12+
13+
- (void)cyl_test {
14+
NSLog(@"🔴类名与方法名:%@(在第%@行), 描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), @"");
15+
}
16+
17+
+ (void)cyl_testClass {
18+
NSLog(@"🔴类名与方法名:%@(在第%@行), 描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), @"");
19+
}
20+
21+
@end

01《招聘一个靠谱的iOS》面试题参考答案/Deme_39_CYLSystemAPIMemoryLeak/Deme_39_CYLSystemAPIMemoryLeak/CYLBaseViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
#import "CYLBaseViewController.h"
10+
#import "CYLBaseViewController+CYLBaseViewControllerExtension.h"
1011

1112
@interface CYLBaseViewController ()
1213

01《招聘一个靠谱的iOS》面试题参考答案/Deme_39_CYLSystemAPIMemoryLeak/Deme_39_CYLSystemAPIMemoryLeak/NSOperationQueueIVARBlock.m

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

99
#import "NSOperationQueueIVARBlock.h"
10+
#import "CYLBaseViewController+CYLBaseViewControllerExtension.h"
1011

1112
@interface NSOperationQueueIVARBlock ()
1213

@@ -16,6 +17,11 @@ @implementation NSOperationQueueIVARBlock
1617

1718
- (void)viewDidLoad {
1819
[super viewDidLoad];
20+
[self cyl_test]; //分类实例方法:必须在子类中手动 import 父类的分类, 否则抛 编译错误❌
21+
[self performSelector:@selector(cyl_test)]; //分类实例方法:必须在子类中手动 import 父类的分类, 否则抛 warning⚠️
22+
[[self class] cyl_testClass]; //分类类方法: 必须在子类中手动 import 父类的分类, 否则编译错误 ❌
23+
[[self class]performSelector:@selector(cyl_testClass)];//分类类方法: 必须在子类中手动 import 父类的分类, 否则抛 warning⚠️
24+
1925
// Do any additional setup after loading the view.
2026
// _mainQueue = [[NSOperationQueue mainQueue] addOperationWithBlock:^{ self.someProperty = xyz; }];
2127
}

0 commit comments

Comments
 (0)