The paper
Runtime issues
Runtime is the core knowledge of iOS development, and if the following problems are solved, then you have a deep understanding of Runtime. Runtime is already open source. There is a source code for ObjC-Runtime that others have debugged and run. You can also find ObjC4 on objC4’s official website
Structural model
- Introduce the Runtime memory model (ISA, object, class, metaclass, structure storage information, etc.)
- Why design Metaclass
class_copyIvarList
&class_copyPropertyList
The difference betweenclass_rw_t
和class_ro_t
The difference betweencategory
How is it loaded, both categoriesload
The loading order of methods, and the loading order of methods with the same name for both categoriescategory
&extension
Difference, can I add Extension to NSObject? What’s the result- Message forwarding mechanism, message forwarding mechanism and the advantages and disadvantages of other languages message mechanism comparison
- At the time of the method call,
Method Query -> Dynamic resolution -> Message forwarding
What did you do IMP
,SEL
,Method
The differences and usage scenariosload
,initialize
What’s the difference between methods? What is the difference between them in inheritance- Talk about the pros and cons of the message forwarding mechanism
Memory management
weak
The implementation principle of?SideTable
What is the structure of- Application of associated objects? How does the system implement the associative object
- How are associated objects managed in memory? How does an associated object implement the weak property
Autoreleasepool
The principle of? What data structures are usedARC
The implementation principle of?ARC
Under theretain & release
What optimizations have been madeARC
What can cause a memory leak
other
Method Swizzle
Matters needing attention- Attribute modifier
atomic
What is the internal implementation of? Is it thread safe - What are some ways of introspection in iOS? What is the internal implementation
Objc_getClass object_getClass
What’s the difference?
NSNotification related
- Implementation principles (structure design, how notifications are stored,
name&observer&SEL
And so on) - Are notifications sent synchronously or asynchronously
NSNotificationCenter
Are messages received and sent in the same thread? How do I send messages asynchronouslyNSNotificationQueue
Is it sent asynchronously or synchronously? In which thread respondsNSNotificationQueue
andrunloop
The relationship between- How do I ensure that the thread receiving the notification is in the main thread
- Does page destruction crash without removing notifications
- What happens when you add the same notification more than once? Multiple removal notifications
- Can the following methods receive notifications? why
// Send notification [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:@"TestNotification" object:@1]; / / receive notifications [NSNotificationCenter defaultCenter postNotificationName: @ "TestNotification" object: nil];Copy the code
Runloop & KVO
runloop
Runloop is not new to any standard iOS development. Familiarity with Runloop is standard. Here are a few typical issues
- How does the app receive touch events
- Why only the main thread
runloop
Is open - Why only refresh the UI on the main thread
PerformSelector
andrunloop
The relationship between- How do I keep threads alive
KVO
As with Runloop, this is standard, and also lists some typical problems
- Realize the principle of
- How do I manually shut down KVO
- Does modifying properties via KVC trigger KVO
- Under what circumstances will KVO crash, and how can it be protected
- Advantages and disadvantages of KVO
Block
block
What does the structure look like- Is a block a class? What are the types
- a
int
Variables are__block
The difference between embellishment or not? Block variable interception block
In the modifiedNSMutableArray
, whether to add__block
- How does memory management work
block
You can usestrong
Modified?- Why is it used to solve circular references
__strong, __weak
modified block
happencopy
The timingBlock
Of the access object typeAuto variable
When theThe ARC and MRC
What’s the difference
multithreading
Mainly by the COMMUNIST Party of China
iOS
How many types of threads are there in development? Respectively comparedGCD
Which queues are available and which queues are provided by defaultGCD
What are the method apisGCD
Relationship between main thread and main queue- How can synchronization be achieved in as many ways as possible
dispatch_once
Realize the principle of- When can a deadlock occur
- What types of thread locks are available and their functions and application scenarios are described
NSOperationQueue
In themaxConcurrentOperationCount
The default valueNSTimer, CADisplayLink, dispatch_source_t
The advantages and disadvantages of
View & image correlation
AutoLayout
How about the principle and performanceUIView & CALayer
The difference between- Event response chain
drawrect & layoutsubviews
Call time- UI refresh principle
- Implicit animation vs. display animation
- What is off-screen rendering
- Difference between imageName and imageWithContentsOfFile
- Will multiple images of the same image be reloaded
- When are images decoded and how are they optimized
- How to optimize image rendering
- If the GPU refresh rate exceeds the 60Hz refresh rate of the iOS screen, what is the phenomenon and how to solve it
Performance optimization
- How to do startup optimization, how to monitor
- How to do caton optimization, how to monitor
- How to optimize power consumption and how to monitor it
- How to do network optimization, how to monitor
Developer certificate
- What is Apple’s purpose in using certificates
- The app Store’s authentication process when installing an app
- How do developers install apps to devices in Debug mode
Architecture design
Typical source code learning
Just list some core iOS open source libraries, these libraries contain a lot of high quality ideas, source code learning must pay attention to each framework to solve the core problem is what, as well as their advantages and disadvantages, so as to really understand and absorb
- AFN
- SDWebImage
- JSPatch, Aspects(although one is not available and the other is not maintained, both libraries are neat and easy to learn)
- Weex/RN, the author thinks that this kind of front-end and client closely related library is must know its principle
- CTMediator and other Router libraries are common routing libraries, which are almost always used in development
- please
Circle of friends
Add in the comments below
Architecture design
- Manual burying point, automatic burying point, visual burying point
MVC, MVP, MVVM
Design patterns- Common design patterns
- The disadvantages of singletons
- Common routing schemes, and comparison of advantages and disadvantages
- If the stability of the project is guaranteed
- Designing an Image Caching Framework (LRU)
- How to design a
git diff
- Designing a thread pool? Draw your architecture diagram
- What is your app architecture, what are its strengths and weaknesses, why are you doing it, and how can you improve it
Other problems
PerformSelector & NSInvocation
Advantages and disadvantages comparedoc
How to implement multiple inheritance? How to face the section- What are the
bug
Can cause crashes, how to prevent crashes - How to monitor crashes
app
(look at LLVM compilation, static linking, dynamic linking, Runtime initialization)- Sandbox the role of each folder partition in the directory
- Briefly describes the
match-o
File structure
System basics
- The difference between processes and threads
HTTPS
Handshake process- What is the
Man-in-the-middle attack
? How to prevent TCP
The handshake process? Why three handshakes, four wavesStack and heap
District differences? Who takes up more memory space- Encryption algorithm:
Symmetric encryption algorithm and asymmetric encryption algorithm
The difference between - common
Symmetric and asymmetric encryption
What are the algorithms MD5, Sha1, Sha256
The difference betweencharles
Packet capture process? Do not usecharles
.4G
How does the network capture packets
Data structures and algorithms
For mobile developers, there are generally no very difficult algorithms, most of which are based on data structures. The author lists some necessary algorithms, of course, you can go to LeetCode to brush up problems when you have time
- Eight sorting algorithms
- The stack and queue
- String handling
- The list
- Binary tree related operations
- Deep search search
- Basic dynamic programming problems, greedy algorithms, binary search