The paper
Due to the large number of questions, this article is just for the questions, I hope to play the reader’s hands-on ability, to explore the next, you can also comment below to reply to your answer or ask a higher quality question!!
Runtime Related Issues
- What is the message mechanism of OC?
- What is the
method swizzling
- use
runtime Associate
Method associated with the object that needs to be in the main objectdealloc
When they were released? runtime
How to implementweak
Automatic setting of variablesnil
? knowSideTable
?
Structural model
- Introduce runtime’s 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, two categoriesload
The order in which methods are loaded, the order in which methods of the same name in both categories are loadedcategory
&extension
Difference, can I add an Extension to NSObject? What’s the result- Message forwarding mechanism, the advantages and disadvantages of message forwarding mechanism and other language message mechanisms
- When the method is called,
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’s the difference in the inheritance relationship- Talk about the pros and cons of message forwarding
Memory management
weak
The implementation principle of?SideTable
What is the structure of psi- Application of associated objects? How does the system implement associated objects
- How is the associated object memory managed? How does an associated object implement the Weak property
Autoreleasepool
The principle of? What are the data structures 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 the methods of introspection in iOS? What is the internal implementation
Class, objc_getClass, and object_getClass
What’s the difference?
NSNotification related
- Implementation principles (structural design, how notifications are stored,
name&observer&SEL
Between, etc.) - Are notifications sent synchronously or asynchronously
NSNotificationCenter
Are receiving and sending messages in the same thread? How do I send messages asynchronouslyNSNotificationQueue
Is it sent asynchronously or synchronously? Which thread respondsNSNotificationQueue
andrunloop
The relationship between- How do I ensure that the notification receiving thread is on the main thread
- Will the notification crash if the page is destroyed without removing it
- What happens when you add the same notification multiple times? Multiple removal notifications
Runloop
Runloop is a familiar feature for any standard iOS developer. Here are a few typical problems
- 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 a few typical problems are listed
- Realize the principle of
- How do I manually close kVO
- Does KVO trigger when a property is changed through KVC
- Under what circumstances will KVO crash and how to prevent it
- Advantages and disadvantages of KVO
Block
block
What does the structure look like- Is block a class? What are the types
- a
int
Variables are__block
Embellished or not? Block block
In the modifiedNSMutableArray
, whether it needs to be added__block
- How does memory management work
block
You can usestrong
Modified?- Why use it when solving circular references
__strong, __weak
modified block
happencopy
The timingBlock
To access the object typeAuto variable
When theThe ARC and MRC
What’s the difference
multithreading
Mainly the COMMUNIST Party
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
The relationship between main thread and main queue- How do you do it, and in as many ways as you can
dispatch_once
Realize the principle of- Under what circumstances does a deadlock occur
- This section describes the types of thread locks and their application scenarios
NSOperationQueue
In themaxConcurrentOperationCount
The default valueNSTimer, CADisplayLink, dispatch_source_t
The advantages and disadvantages of
View & image correlation
AutoLayout
The principle, performance howUIView & CALayer
The difference between- Event response chain
drawrect & layoutsubviews
Call time- UI refresh principle
- Implicit animation & Show animation difference
- What is off-screen rendering
- ImageName and imageWithContentsOfFile
- Will the same image be loaded repeatedly
- When was the image decoded and how was it optimized
- How to optimize the picture rendering
- If the GPU refresh rate exceeds the 60Hz refresh rate of the iOS screen, what is the problem and how to solve it
Developer certificate
- What does Apple use certificates for
- Certification process for app installation in AppStore
- How do developers install apps on devices in debug mode
Architecture design
Learning typical source code
Just list some iOS more core open source libraries, these libraries contain a lot of high-quality ideas, source learning must pay attention to each framework to solve the core problem is what, as well as their advantages and disadvantages, so as to truly understand and absorb
- AFN
- SDWebImage
- JSPatch, Aspects(although one is not available and the other is not maintained, both libraries are neat enough to learn)
- Weex/RN, the author believes that it is necessary to know the principle of this library which is closely related to the front end and the client
- CTMediator, other router libraries, these are common routing libraries, development will be basically used
- More please
The reader
Add in the comments below
Architecture design
- Manual burial point, automatic burial point, visual burial point
MVC, MVP, MVVM
Design patterns- Common design patterns
- The downside of singletons
- Common routing schemes and their 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 the pros and cons, why, and how to improve it
Other problems
PerformSelector & NSInvocation
Advantages and disadvantages comparedoc
How to implement multiple inheritance? How to face the section- What are the
bug
Will cause a crash, how to prevent the crash - How to Monitor crashes
app
(Look at LLVM compilation, static linking, dynamic linking, runtime initialization)- The role of each folder partition in the sandbox directory
- Briefly describes the
match-o
File structure
System Basics
-
The difference between processes and threads
-
HTTPS handshake process
-
What is a man-in-the-middle attack? How to prevent
-
TCP handshake process? Why three handshakes and four waves
-
The difference between heap and stack? Who takes up more memory space
-
Encryption algorithm: The difference between symmetric encryption algorithm and asymmetric encryption algorithm
-
What are the common symmetric encryption and asymmetric encryption algorithms
-
MD5, Sha1, and Sha256 are different
-
Charles Packet capture process? How to capture packets on 4G without Charles
Data structures and algorithms
For mobile developers, generally do not encounter very difficult algorithms, mostly based on data structures, I listed some of the necessary algorithms, of course, there is time to go to LeetCode brush questions
- Eight Sorting algorithms
- The stack and queue
- String processing
- The list
- Operations related to binary trees
- Deep search search
- Basic dynamic programming, greedy algorithm, binary search
Original: [iOS development interview, commonly asked interview questions (set) – Jane books (jianshu.com)] (www.jianshu.com/p/4dd8d26ea)…
Portal:
IOS Interview Collection + Answers (1-5) (Juejin.cn)
IOS Interview collection + Answer (1) (juejin.cn)
IOS Interview collection + Answer (2) (juejin.cn)
IOS Interview collection + Answer (3) (juejin.cn)
IOS Interview collection + Answer (4) (juejin.cn)
IOS Interview collection + Answer (5) (juejin.cn)
(qq.com)