There are a thousand Hamlets in the eyes of a thousand readers, and a thousand advanced iOS interview questions in the eyes of a thousand iOS programmers. Here are some of the questions I think you can use to interview a senior iOS programmer.

The topic of this set of questions has nothing to do with the company and the business, and also does not represent the author himself can answer these questions very well, the author just feels a part of the better questions from the interview questions collected inside pulled out just.

The interview questions were collected from three sources:

  1. I have collected and sorted out the interview questions in the process of preparing for the interview.
  2. I thought about the new questions in the process of preparing for the interview.
  3. I encountered in the interview process feel better questions.

This paper is divided into three parts:

  1. The interview questions
  2. What do you like and what don’t
  3. You are advised to prepare data structure and algorithm questions

The first part is the interview questions; The second part gives the author likes and dislikes to investigate the question and the reason; The third part is why I suggest you prepare data structure and algorithm questions.

The interview questions

IOS based questions

  1. What’s the difference between classification and extension? What can they be used for? What are the limitations of classification? What are the members of the structure of classification?
  2. Let’s talk about the implementation mechanism of atomic; Why can’t it be absolutely thread-safe (preferably in context)?
  3. What happens to a weak modified object when it is released? How does it work? Do you know sideTable? Can you draw the structure inside?
  4. What are the applications of associated objects and how does the system manage associated objects? Does it need to be freed by manually setting all the associated object Pointers to null?
  5. Underlying implementation of KVO? How do I cancel the system default KVO and trigger it manually (condition the KVO trigger: if the changed value meets a certain condition, then trigger KVO)?
  6. AutoreleasepoolWhat are the data structures used?AutoreleasePoolPageDo you know about structures?
  7. What about objects, class objects, metaclass, and metaclass structures and how they relate to each other? Why are object methods not stored in the object structure, but in the class object structure?
  8. class_ro_tclass_rw_tThe difference between?
  9. How many ways to introspect in iOS?classMethods andobjc_getClassWhat’s the difference?
  10. The method that creates the class at run timeobjc_allocateClassPairWhy is the end of the method name pair?
  11. An int variable is__blockEmbellished or not?
  12. Why use outside of blocks__weakIt needs to be used internally while decorating__strongModified?
  13. What does RunLoop do? Do you know the inner workings of it? (Preferably in conjunction with thread and memory management)
  14. Which scenes can trigger off-screen rendering? (Say what you know)

IOS practical problem

  1. How to slim down the AppDelegate?
  2. What is reflection? Can you name some application scenarios? (Say what you know)
  3. What scenarios are NSOperation easier to implement than GCD? (or the points NSOperation is better than GCD, tell as many as you know)
  4. App startup optimization strategy? It is better to talk about the process of starting main() before and after the execution of the function.
  5. Do you understand the idea of non-trace burying point of App? What characteristics do you think an ideal non-trace buried point system should have? (Say what you know)
  6. What do you know about app crashes and how to block and resolve them? (Say what you know)
  7. What situations do you know will lead to app shutdown, and what methods can be used to avoid it? (Say what you know)

The network problem

  1. What are the optimization strategies for the App network layer?
  2. Why does TCP need three handshakes and four waves?
  3. What is the difference between symmetric encryption and asymmetric encryption? What algorithms are implemented?
  4. HTTPS handshake process? Why do you need asymmetric encryption for key delivery? Do you understand two-way authentication?
  5. How does HTTPS implement authentication and authentication integrity?
  6. How to catch HTTPS packets with Charles? What is the principle and process?
  7. What is a man-in-the-middle attack? How to avoid it?

Computer system problems

  1. Do you understand the compilation process? What are the steps?
  2. What about static links? What’s the difference between a static library and a dynamic library?
  3. What are the functions of several areas of memory?
  4. What’s the difference between static and const?
  5. Do you know inline functions?
  6. When do deadlocks occur? How to avoid it?
  7. What is your understanding of thread safety?
  8. List the thread synchronization strategies you know?
  9. What kinds of locks are available? How do they work? What’s the difference between them? It is best to combine it with the usage scenario

Design Pattern questions

  1. What design patterns do you know besides singletons and observer design patterns? To introduce each of them
  2. Which design pattern do you like best? Why is that?
  3. What design patterns are practiced in the iOS SDK?
  4. ** What problems are design patterns designed to solve?
  5. ** What is the composition of the design pattern and how it works?
  6. ** What are the pros and cons of the design pattern?

Architecture & Design questions

  1. The difference between MVC and MVVM? What’s the difference between MVVM and MVP?
  2. Do you know several principles of object-oriented design? The best way to think about it is in context.
  3. Can you tell me some refactoring tips? When do you think refactoring is appropriate?
  4. What do you think is the difference between frameworks and design patterns?
  5. Which third-party frameworks have you seen and how are they designed? Where is the design good, where is the design bad, how can it be improved? (The last three questions in this question are already too difficult, and companies that aren’t too busy don’t recommend exploring them.)

Data structure & algorithm problem

  1. What’s the difference between a linked list and an array? What is the time complexity of insert and query?
  2. How is a hash table implemented? How do I resolve address conflicts?
  3. Sort problem: bubble sort, choice sort, insertion sort, quicksort (2 way, 3 way) can write what?
  4. Linked list: how to detect whether there is a link in the list? How do I delete all nodes in a linked list that are equal to a value?
  5. Array problem: How to find two elements in an ordered array whose sum is equal to a given value? How do I merge two ordered arrays and maintain order?
  6. Binary tree problem: how to reverse a binary tree? How do I verify that two binary trees are exactly equal?

Likes and dislikes

It’s easy to see that the iOS portion of the interview questions is actually not that large (one-third), because I think:

Advanced iOS Development = Advanced development + (Advanced) iOS development.

The advanced development part should be considered as a priority, and the purpose is to first verify whether the candidate has the basic qualities necessary for advanced development. This level of knowledge directly affects a developer’s research and design abilities, both horizontal and vertical. In my opinion, the following ** (advanced) iOS development ** section only examines the understanding of iOS itself (APIS, systems, development tools, etc.).

Some of my personal favorites are:

  1. What design patterns are practiced in the iOS SDK?
  2. What is your understanding of thread safety?
  3. What do you know about app crashes and how to block and resolve them?
  4. Which third-party frameworks have you seen and how are they designed?
  5. Can you tell me some refactoring tips? When do you think refactoring is appropriate?
  1. This question kills two birds with one stone. It not only examines the interviewers’ understanding of the general knowledge of design patterns, but also examines their familiarity and thinking degree with the iOS SDK. Here can be briefly mentioned: singleton: UIApplication; Observer mode: KVO; Class cluster: NSNumber; Decorator mode: classification; Command mode: NSInvocation; Enjoy element mode: UITableviewCell (reuse of UITableview). For more, you can check out the Book “The Tao of Objective-C Programming,” which describes many of the design patterns used in the iOS SDK.
  2. There is only one thread accessing at a time. However, if this definition is followed, then constants that cannot be changed are not considered thread-safe, so obviously this definition is wrong. So learning things to have critical thinking, especially when reading blogs, a lot of circumstances need to think about, take the initiative to authenticate, to think.
  3. There are many reasons why an app crashes, such as sending a method to an object that it cannot respond to, array out of bounds, adding nil objects to a collection class, string access out of bounds, KVO improperly removing associated keys (this is not the only reason KVO crashes), etc. Crashes are very disruptive to the user experience, so I think a senior iOS developer should have the ability to avoid them, or at least be aware of the scenarios that lead to them.
  4. Looking at some excellent open source framework code, combing the implementation ideas and details can help us improve the ability to design systems in similar scenarios. In fact, the truth is very simple, what is the way to learn to write a composition when I was young? – It’s just a recitation. Since writing is a kind of output, if you don’t have the accumulation of good words and sentences (input), naturally you can’t write a rich article. The same goes for writing code
  5. The ability to refactor is one of the abilities I value very much. In fact, I personally believe about refactoring technique which can learn early and writing the code “as possible behind one pace reachs the designated position. (if the scheduling permits), but also help improve the ability of design code: how to design a low coupling, high cohesion, easy extension, easy to modify the system? There is a book devoted to refactoring: Refactoring improves the Design of Existing Code.

Here are the questions I like to examine. Here are the questions I don’t:

  1. How do I query online crashes?
  2. Do you understand the release process? How many certificates are there?
  3. Have you ever done payment/map/share?
  4. What is a DYSM file and what does it do?

There are two reasons why I did not examine such questions:

  1. These questions fail to examine the basic qualities of a programmer because they are limited to iOS itself.
  2. This kind of problem is often “do it know”, there is no way to quantify ability. Encountered in the actual development has done; Even if you haven’t, I believe a good programmer will do it efficiently the first time.

You are advised to prepare data structure and algorithm questions

At the end of this article, we will talk about data structures and algorithms.

This type of question is something that big companies like to test, which means most companies don’t actually test it (but it’s a plus if you know it). However, I personally think that if time permits, it would be better to prepare some. In addition to the interview, the learning of algorithms is helpful to the improvement of programming ability, which I have deep experience:

In the process of preparing for the interview, the author drew some questions on LeetCode, among which there were about 30 questions about linked list, array and binary tree, and put these questions into the personal warehouse: awesome-algorithm-question-solution. Welcome to PR Swift, Java algorithm questions and answers ~

In the process of brushing questions and learning gradually can feel the understanding of the code to improve a lot, especially the list of questions can strengthen the understanding of pointer operation, and the execution of the condition of the inspection, the boundary problem processing ability has also improved some ~

Well, this set of questions to share here, in the article after also suggest that you usually pay attention to the learning of data structure and algorithm. As with the last post, this blog is a little more subjective, and I hope readers can communicate with me more

This post has been synchronized to personal blog: A set of advanced iOS interview questions


The author recently opened a personal public account, mainly to share programming, reading notes, thinking articles.

  • Programming articles: a selection of my previous technical articles, as well as subsequent technical articles (mainly original), will gradually move away from iOS content and focus on improving programming capabilities.
  • Reading notes: Share your reading notes on programming, thinking, psychology, and workplace books.
  • Thinking articles: share my thoughts on technology and life.

Because there is a limit to the number of messages published on the official account every day, so far we have not published all the selected articles in the past on the official account, and will be published gradually in the future.

And because of the various limitations of the major blog platform, later will be published on the public account some short and concise, to see the big dry goods articles oh ~

Scan the qr code below and click follow, looking forward to growing together with you ~