This column will be updated continuously — please pay attention to iOS friends!

(The answer is not unique, only for reference, there are benefits at the end of the article)

Famous dafang iOS development interview questions

I. Tencent — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

tencent

One side

1, introduce the internship project, task division, what work did? 2. Network related: What network libraries are used in the project? Have you ever used ASIHTTP library? What needs to be set? 4, in Hangzhou HTTP request server response fast, may be close to the server, while in Shenzhen access is very slow, what is the reason? If a user complains, how do you analyze the problem? 5. What methods of HTTP requests have been used? When to select GET, POST, and PUT? 6, TCP establish a connection process, disconnect the process, why four handshake? 7. Which data stores are used in the project? Know what data storage methods are available in iOS? When and how to store? 8. How MVVM implements binding 9. What is the difference between block and notification and what scenarios are applicable 10. Asked for several consecutive, is an array, walk, but I forgot, just remember the last is to find out the repeat number 11 in the array, the difference between processes and threads 12, program at runtime what operating system in addition to allocate memory space and 13, 14 interprocess communication way, how to detect whether application caton version 15, release out, How do I collect Crash logs? Third-party platforms such as Bugly are not used or how do these third-party platforms collect crash logs? 16. Does using _property in a block cause circular references? How to solve it? Instead of using self->_property, can I use valueforKey to access it? Can I change its value inside the block? Setvalueforkey? You can change its value, you can solve this by using valueforkey, explicitly using self, holding a weak reference to self outside the block.

Second interview

What is the basic difference between ARC and MRC? NSThread, GCD, NSOperation related. How to start a thread? Can threads be cancelled? 7, child thread called connection method, why not callback? Since there is no runloop, the task is destroyed upon execution, so there is no callback. 10. Save an address book, including adding, deleting, modifying and checking, what data structure is used 11. When is the autorelease variable released? When is the autorelease variable in the child thread released? When is the autorelease variable in the child thread released? What is the difference between GCD and NSOperation? 16. Have you ever encountered deadlocks in a project? How to solve it? Database access is thread safe and does not cause deadlocks. What is a deadlock? 17, Viewcontroller lifecycle? 18, init method, set the background color, will it take effect? Why? What new features have been announced for WWDC2016? Any attention to the latest features apple series 20, have seen what source, about thinking 21, two same node list to find the first 22, 23, looking for a list of string rotate bottom in the first 24 k nodes, put a list on the left is larger than a certain value, its smaller on the right side of 25, the order in the binary tree traversal, non-recursive

2. Baidu — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

baidu

One side

1. Basic iOS knowledge

2. Basic Knowledge of Python, such as multithreading, thread safety, collection classes, JVM, classes, etc.

3, iOS some source reading

4, excellent third party framework source reading

5. Knowledge of GLSurfaceView, OpenGL, Shader, drawing process.

6, ask about the current project, as well as specific implementation and optimization.

7. Communication between multiple processes, Binder mechanism.

8, asked to see which framework source, EventBus, Volley talked about it.

Second interview

1. Compare the advantages and disadvantages of Delegate, Notification and KVO

How many ways can a square red view be implemented in the middle of a UI?

3. What is the response mechanism when the hand touches the screen? Who is the first responder? What is the relationship between UIView and UIResponse?

What is the lifecycle of UIViewController? When I ask UIViewController only alloc and don’t use it,

Is the VIEW of UIViewController loaded? If it’s not loaded when is it loaded? Is it better to draw a UILabel directly or draw a UILabel using DrawRect? Why is that? Which one takes up less memory? Why is that?

6. Does AFNetworking support ipv6?

7, the project is 64-bit, why use 64-bit? How do I change it to 64 bits? What is i386? What are they related to?

8. How many states does an iOS app have? Follow-up, can the code back to the background be executed? Double click the home button, can the code be executed?

9. How much memory is used for ICONS? For example, for a 200×300 image, how much memory should I reasonably use?

Why do blocks cause memory leaks?

11. Is [object copy] a shallow copy or a deep copy? Why shallow copy? Which protocol does copy implement?

12. What’s the difference between images.xcassets and Images?

Three sides are all asked about iOS, ask really detailed, need a solid foundation, to each mechanism is really enough to understand, otherwise it is a little difficult to answer.

1. Memory management

2. Multithreading

3. Various queues

Thread locks

5, MVVM is to check my iOS ability in the end whether there is water. Ask very fine, really need to have a solid enough foundation.

Three: Headlines — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

headlines

One side

1. Introduce yourself

2. Project related

3. How to customize navigation jump

Talk about your understanding of Runtime

5, the use of KVC

6. What should be noticed when using Method Swizzling? (Some checks need to be done during version iterations to prevent changes in system library functions)

Talk about understanding reference counting

Talk about understanding runloop

9. What are the states of runloop

10. Application scenarios of AutoReleasepool

TableView optimization, how to reduce the lag

12, copy assign retain weak keywords

Transform JSON to Model

14. Code layout

15. Multi-screen adaptation

HTTP request headers and response headers

17, Cookie,

In the 18th and NSCache

19. Design your own cache

How to implement LRU

21, SDWebImage

22. Binary tree preorder traversal (recursive and non-recursive)

Second interview

1. Some disadvantages of MVC

2. Talk about other architectures

3. You know how to code

4. Algorithm string flip

5. Multithreading and their differences

Relationship between queues and threads

A thread safe question

8. What locks are available

9, the keyword of the attribute

10. Can ASSIGN be used on OC objects

The difference between copy and strong

Weak: How to automatically assign nil

13. Why do immutable objects use copy

Can assing be used in an object

The difference between Pod Update and Pod Install

The difference between layoutIfNeeded and setNeedsLayout

17. How the packet capture tool captures HTTPS

18. Relationship between isEquel and hash

19. Bitmap structure

Variable array implementation principle

How to hook a method of an object without affecting other objects

22, How to avoid if else

The difference between spin locks and mutex

On three sides

1, introduce the project, mainly introduce their strengths

2. Will the elements in the cop array be copied

3. Shallow and deep copies of arrays

4. Why is TCP three handshakes and four waves

The headline has always been the video side, and it’s a one-stop service. Generally speaking, I feel good. Anyway, the main thing is that I need to have a solid enough foundation.

Four: Ali — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

Ali.

One side

1. Introduce the project

2. In KVO, how does he know that the listener has changed?

3. How do dictionaries work? How do you quickly get value out of 100w?

4, a on-line project, know that this method may go wrong, in the premise of not destroying the method, how to do?

What is the difference between a Block and a function pointer?

6. Performance optimization

YYModel and AF source code

How to design json to Model

9, architecture,

Their interviewers seem to like to ask me low-level questions, such as the KVO questions I will be asked in this interview. Problem [1], looks like very hanging, careful as if not to think, may really not understand, problem [2], this is pure data structure problem. Problem [3], this is the iOS runTime problem, all it takes is ISA, and some swizzling technical problems [4], depending on how extensive you are.

Second interview

1. The difference between shallow and deep copies

2, circular reference Block, how to solve, principle

3. Compare blocks and delegates

4. The realization principle of KVO

5. Implementation principle of Autorelease Pool

6. Message forwarding mechanism

7. Four conditions for thread deadlock

The difference between processes and threads

9. Persistence

I said it should be written in layoutSubViews. He said it would be called many times. Then he argued for a while

On three sides

Mainly asked some things about the project and gave me some scenarios to ask how to achieve

Introduce yourself Introduce some of the difficulties of the project

What is the main thread relative to

What determines the memory footprint of an image

The role of indexes

Advantages and disadvantages of indexing

Look for the smallest k number in the array

How to optimize Taobao dropdown loading more

The process by which taobao pages send HTTP requests

Introduce MVVM

Know which design patterns

The interviewers mainly talked about some specific scenarios and some basic issues, the basic should be not too big problems.

Meituan — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

Meituan

One side

1. Ask about the items on your resume and then start asking about knowledge points.

2. Volley’s source code, which has been discussed for a long time in the image cache section,

3. Life cycle of the vision controller

4. Database

5, multi-threaded (NSTread, NSOPeration, GCDA+block)

6. Differences between GET and POST

7. Mobile phone ADAPTS to some solutions

8. Matters needing attention for real machine debugging and project launching

9, static method can be rewritten these about an hour and a half, at the beginning of a little nervous, slowly talk, much better, the interviewer’s speed is a little fast, always need to repeat the interviewer, I also inadvertently spoke faster, but you can see the interviewer is very good.

Second interview

What is the difference between id and NILL?

2. What happens when you send a message to an NILL object?

Synchronization and asynchrony in HTTP

4. Differences between MVC and MVVM Using MVVM to achieve a business. VC is the entry, VC1 shows the list of “province”, VC2 shows the list of “city” associated with the province, VC3 shows the list of “county” associated with the city. VC goes to VC1, VC1 goes to VC2, VC2 goes to VC3, VC3 goes to VC. The relevant points are how to design viewModels and models, and VC3 to VC. How to write unit tests, such as writing a network library, how to test the network library, how to write more comprehensive use cases. What happens between pulling code from Git and generating.ipa, and what files are generated between. What books you’ve read recently, what frameworks you’ve looked at, and what you’ve learned. Speaking of JSPatch, ask how JSPatch handles blocks. What you’re good at. What kind of setbacks.

– Added questions asked in the second interview: how to detect memory leak, zombie object and so on if there is no instruments.

On three sides

1. How does iOS manage resources?

2. Several important Features of Python

3, the network structure of five layers, each layer of protocol, because my network is not very good, also asked some other questions (such as the difference between MAC address and IP address).

First, I talked about the feelings and problems of the first two, and then I talked to the interviewer about the difference between singletons and global variables. What is the difference between a Block and a Protocol? What problem is a Block used to solve? Design patterns for iOS. Why iOS does not have a “Builder” like Java and C. Average and worst time complexity of bubble, insert, quicksort.

Heap sort. Is there order n sorting? Recent problems solved on stackOverFlow, open source frameworks read, books read, hobbies, most rewarding things.

Six: Dchang — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

The interview questions

  • Do draw Rect necessarily affect performance? What is the essential difference between UI Dynamics and UIKit Animation?
  • 2. How to use UllmageView to display super-high-resolution images? What if you want to support scaling?
  • 3. Do you know Fishhook? Why can’t Fishhook modify symbols in non-dynamically linked libraries?
  • 4. What’s the difference between calling virtual methods in C++ and sending messages in Objective-C?
  • 5. Learn about Placement New? How do you implement this in Objective-C
  • How to manage Objective-C objects using the C++ library container in an ARC environment?
  • 7. What are the grammatical differences between id, sef and super?
  • 8. What is ISA? Is it a pointer to the Cass object itself?
  • What else can we do to capture variables other than using blocks? What are the limitations?
  • 10. What are the differences between NSDictionary and NSHashTable, and what are their usage scenarios?
  • 11. Have you ever used Swit? How to evaluate the design of String Index?
  • 12. Suppose there is a TCP connection between the iPhone and the server, and the Internet of the iPhone is suddenly disconnected. Can the server notify the offline iPhone in a short period of time?
  • 13. Why cannot the Wireshark capture the original SSL data directly?
  • 14. Is backtrace implemented in user mode? Can you give us a general idea of how to implement it?
  • 15. What is the difference between an exception generated by a pointer to malloc double free and an exception that might be generated by accessing a freed pointer? Why does accessing a Freed pointer not always produce an exception?
  • 16. Is a RunLoop an infinite loop that runs continuously? Why is that?
  • 17. Have you seen the runtime source code? Source code often fastPath, flowPath is what?
  • 18. What is the meaning of a SideTable in Runtime
  • 19. How does Objective-C guarantee AB stability after the upgrade?

Douyin — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

One side

  1. Last public parent (two nodes, both of which may be null, both of which may not be on the tree.
  2. Reverse linked List (general question)
  3. Do you know HTTP? HTTP2.0 introduce
  4. Ios9-13, one feature per release
  5. How to implement a unified process after multiple tasks have been executed (synchronous block, fence function, scheduling group)
  6. Do not use SDWebImage, how to implement similar logic (design your own image request and cache, simple talk about SDWebImage ideas)
  7. Each TableViewCell has a UIImageView to load an image, if there is no cache, and there are five cells requesting a url, it is definitely not practical to send a request at the same time, how to deal with it?
  8. When you slide a TableView on wechat, the GIF doesn’t move. Why? (Determined by the Mode of the Runloop)
  9. Have you read about WebSocket?

Second interview

  1. How to print all subviews of a UIView without experimenting with recursion
  2. Design a picture cache system, and code implementation
  3. Static analysis based on LLVM/Clang is introduced
  4. Seven-layer protocol stack
  5. Which layer of protocol is HTTP
  6. What are the common HTTP return codes?
  7. What is HTTP besides GET and POST? (UPDATE, DELETE, HEAD)
  8. An introduction to HTTPS
  9. Does HTTPS prevent man-in-the-middle attacks?
  10. Differences between TCP and UDP
  11. The difference between threads and processes
  12. How do threads communicate with each other
  13. How to ensure thread safety without using GCD?
  14. What are the multithreading options for iOS? (NSOperation, NSThread, GCD)
  15. What’s the difference between synchronous and asynchronous?
  16. What’s the difference between a serial queue and a parallel queue?
  17. The relationship between queues and threads
  18. How do deadlocks occur?

On three sides

  1. Merge sorted linked lists
  2. Does HTTPS use symmetric encryption or asymmetric encryption?
  3. This section describes TCP slow start and fast recovery
  4. The entire process from the client sending the network request to the response (similar to the process of opening a web page)
  5. If the DNS resolves an ISP server, what is the logic?
  6. This paper introduces the design of dictionary model + night mode
  7. Why not use a mature dictionary to turn the three sides of the model? Have you read about it?
  8. What are the drawbacks of night mode and how can it be optimized?
  9. What are the locks?
  10. Data storage, how to save (FMDB)
  11. How do thread-safety errors occur?

Pinduoduo — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

One side

  1. How to implement JSON transformation model; Night mode; Player Architecture Design

  2. Process of request

  3. Is the server return format other than JSON?

  4. Which OC objects are thread-safe

  5. Why update the UI on the main thread

  6. How to ensure the OC container data security in multithreading

  7. How is the memory of SDWebImage designed? What are the update principles

  8. Two algorithm questions:

    1. {} Determine the matching of parentheses
    2. There is only one kind of parentheses, calculate the minimum number of parentheses to match

Second interview

  1. When will +load and +initialize be called? When will +load and +initialize be called
  2. How to understand the dynamics of OC
  3. Introduce the message forwarding mechanism and describe the system apis used in these processes
  4. What do you mean by Block
  5. Block variable interception mechanism
  6. __block implementation principle
  7. Memory management mechanism
  8. When the user clicks on the screen, how does the system find a view and decide that it should respond to the event

Fast hand — summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

  • One side
  1. IOS Reflection Mechanism
  2. The difference between iOS Timer and CADisplay
  3. Binary tree, binary balanced tree, AVL, red black tree, B tree difference
  4. Binary tree common node
  5. Random number generation, true random number and pseudo-random number
  6. How do you swap two numbers without a third person
  7. 1000 bottles, 1 bottle of poison, only 10 rats, rats eat after a week will die, how to test.
  • Second interview
  1. UI rendering steps, view packaging process, CPU and GPU work, why double buffering
  2. How does the image display, and the image buffer
  3. What’s in the NSObject structure, and why is it 16 bytes in size
  4. How do we do KVO, does _ fire, does the member variable fire, does KVC + member variable fire, how do we fire KVO without a setter
  5. Operating system memory layout, what areas
  6. The memory layout of an OC object
  7. How to optimize the slide
  8. What is Runtime, what is runloop, and how many modes are there
  9. NSObject memory layout
  10. Isa pointer and super pointer
  11. What is a metaclass
  12. Do all OC objects inherit from NSObject? What’s the ID
  13. Clear cache policy of SDWebImage
  14. What is the block
  15. How to implement LRU algorithm
  16. Method calls for Swift and OC
  17. The common node of two linked lists
  18. At the beginning of the middle of the list, the principle is stated
  19. The best demonstration of your skills in the project.
  • On three sides

1. What is hash

2. The specific implementation of hash, how to hash an object to the specific memory area.

3. Expand the hash array

4. How many kinds of weight can be weighed by a balance and four weights?

Ten: Tiger teeth — a summary of the latest iOS interview questions

About the interview question, may not have so much time to sum up the answer, what need to discuss the place welcome everyone to teach. Mainly record the preparation process, and some summary of the interview, hope to help the students who are interviewing or will be interviewed.

  • One side
  1. Project architecture, does the project write itself
  2. How is the FPS calculated
  3. Is there any other way to use cadisplay
  4. How to implement KVO
  5. Leaks how to implement
  6. How does the code implement listening for zombie objects
  7. ImageWithName When does the codec occur and on what thread
  8. What’s in the ISA pointer
  9. Message sending and message forwarding processes
  10. How to store the parameters in the function
  11. Oc is an empty function with arguments
  12. Are they stored in stacks or registers
  13. Search time complexity for red-black trees
  14. The realization of the nsdictionary
  15. Various locks for iOS
  16. How do you implement dispatch once, and what are the considerations
  17. What happens if we use two @synconize locks in the same thread, recursive or non-recursive locks
  18. How to increase the button click range
  • Second interview
  1. Said the ARC
  2. What can Autoreleasepool be used for
  3. When is the object released? Is it released as soon as it comes out
  4. What can message forwarding be used for
  5. What is a Runloop and what do you use it for
  6. Talk about C++ polymorphism and vtables
  7. How does TCP ensure data transmission integrity
  8. TCP Why the three-way handshake
  9. HTTP and HTTPS, asymmetric encryption all the way through
  10. Open question, a lot of out-of-order data, how do you think about sorting method design
  11. Views on RxSwift, has it ever worked?
  • On three sides
  1. IOS object pointer size
  2. Object allocated to heap or stack
  3. How does HTTP distinguish between a header and a body
  4. Can multiple threads access the same object? Multiple processes
  5. Video PTS and DTS
  6. Which is the best point to lose frames
  7. The performance of iOS locks, whether they are millisecond level or subtle level
  8. Whether the HTTP request is asynchronous or synchronous
  9. What about Rn and Flutter

11: iOS Interview — the latest fast iOS interview questions

background

The face is fast hand X3 position, video interview, do not support the weekend, but can choose the evening time. The video interview was conducted via Bulkee.com. Here are the questions I wrote down for each round. I will not answer some of the basic iOS questions.

One side

1. Recursively write an algorithm that computes the sum from 1 to 100.

1. func sum(value: Int) -> Int { 2. if value <= 0 { 3. return 0 4. } 5. var number = value 6. return value + sum(value: Let result = sum(value: 100) 10. Print (result) 11. Copy the codeCopy the code

After writing the algorithm, I asked several questions, which are the basis of the algorithm:

  • What is the time complexity of the algorithm
  • What are the disadvantages of recursion
  • Can I do that without recursion, can I get down to order one?

2. What is the function of property? What are the keywords?

3, how to find the property of the superclass?

4, NSArray, NSDictionary should be how to choose keywords?

5, copy and muteCopy what is the difference, deep copy and shallow copy what is the meaning, how to achieve deep copy?

What have you ever done with Runtime? How is method exchange implemented in Runtime?

Let’s talk about KVC and KVO. Does KVC call setter methods?

8. What is the function of __block

9. Tell me what you know about the COMMUNIST Party of China (GCD). What methods does it have and what does it do?

10. Do you know about binary trees?

The interviewer wants to follow up with this question. I said I didn’t, and there was no follow-up.

Second interview

The difference between ARC and MRC. How does iOS manage reference counts? When does the reference count increase by one and when does the reference count decrease by one?

2. What happens when [object AutoRelease] is executed under MRC?

3. How does OC implement multiple inheritance?

That was not a good answer. In fact, by means of message forwarding, protocol and category can implement multiple inheritance indirectly.

4. What do you know about design patterns and how one of them is used?

5, is there any open source library let you use very comfortable, talk about the place that makes you comfortable.

6, a 100*100, RGBA PNG image decompressed after how much memory space.

5, algorithm problem

Given a number arR, determine whether all the numbers in the array arR appear only once.

This is not required to write, said to provide ideas on the line. The solution I gave at the time was to use a dictionary to store the handy elements in the convenience array, and if the new element is in the dictionary later in the convenience procedure, it means that there are repeated numbers. The time complexity is order n.

I also asked if there was any way to optimize it, and I came up with the idea of turning the array into a Set and comparing it to the original array to see if the number of the two sets changed.

7. Because I introduced myself to him that I used Swift more often, and then asked him about the differences between Swift and OC, as well as the advantages and disadvantages of each.

8. Why did you leave? What are your career plans?

On three sides

1, given an array of ints, use the elements in the array to form a maximum number, since numbers can be very large.

Input: [3,30,34,5,9] 2. Output: 9534330 3. Copy the codeCopy the code

This is Problem 179 from LeetCode, medium difficulty. Interviewer let the train of thought first, then go to do the problem. Just to be clear, I haven’t done this problem before. At that time, the idea was to use the bubble method for sorting. The premise of sorting was to complete the loop of fewer digits, for example, the comparison of 3 and 30 became the comparison of 33 and 30, the comparison of 34 and 4 became the comparison of 34 and 44, and then the result was integrated into string output from large to small.

But it turns out that it’s not that easy, because if you’re going to have two and three digits, you’re going to have to have the least common multiple of the digits, and you’re going to have to convert them all into six digits. After struggling for five minutes, I just did it.

If you add some Swift higher-order functions, you can write:

1. func largestNumber(_ nums: [Int]) -> String { 2. let sort = nums.map {"($0)"}.sorted { (lStr, rStr) -> Bool in 3. return lStr + rStr > rStr + lStr 4. } 5. let result = sort.joined() 6. if result.prefix(1) == "0" { 7. return "0" 8. } else { 9. return result 10. } 11. } 12. Copy the codeCopy the code

2. There is such a method in the projectfunc findfile(dir: String suffix: String) -> [String]You can retrieve the desired file by entering the folder directory and suffix.

For example, if you want to retrieve a TXT file or an MP4 file in a file, just pass in dir and suffix. Now there are some requirements, such as retrieving TXT in UTF8 format or MP4 in H264 encoding. There are also some requirements, such as finding files that have been updated in the last week. How can you optimize this class to meet these requirements?

The first thing that comes to my mind is that it is impossible to complete so many requirements in one method, and different methods need to be broken down according to different scenarios. However, these are all file operations, and there is a common method that is to retrieve files. This method requires passing in the file directory, and then recursively returns all file paths in the current directory. The external invocation logic for different scenarios is done with an enum, with different values corresponding to different types of the same range.

The interviewer is more concerned about how to write the internal shared file retrieval, he said how to do if there are too many sub-files, how to optimize. I’m a little confused, looking for a file is at least to go through again, too many subfiles, this should be unable to optimize ah. It got stuck for a while, but then he gave a hint about whether or not you could do it with a block, return the file path out, and let the external decide whether or not the current file is available, and finally the external calling class looks like this.

Func findDir(_ dir: String) -> [String] 3. Func findDir(_ dir: String, block: ((String) -> Bool)) 5. Copy the codeCopy the code

I think it’s ok to return the contents of the directory with a block, at least not all the files in the directory are held by one object, and the previous setup is to verify the benefits of the block scheme.

In fact, after thinking about this problem is not what difficult, this writing method has written, but at that time is not to think, maybe the front circle of the fowing to me with a bias, said the loss is not loss, more efforts in the future.

conclusion

Overall, kuaishou’s questions were simpler than the iOS interview questions I’ve seen elsewhere. The first is the basic knowledge, the second is more comprehensive, more let oneself talk about some technical understanding, the third is more practical.

Although the algorithm has three rounds, but relatively simple, even if you can’t write it out, you can also have ideas. Of course, writing it out is definitely a plus, so when you’re preparing for the interview, you should read it. Algorithm related, sorting, array, binary tree, these are the key categories.

Bytedance’s latest iOS development interview questions

The preface

The epidemic is basically under control, and the interview is also starting gradually. The following iOS interview questions are for reference only. After all, the interview is not controllable, but the more you know, the greater the natural opportunity!

Byte side contents:

1. Introduce yourself

2. Introduce a project from your resume

3. Three elements of object orientation

4. Polymorphism?

5. Which is more efficient in Java, Python or OC?

6, Property, where copy?

Property(Nonatomatic, copy) NSMutableArray

The difference between Copy and MutableCopy

9. Explain the categories and principles

10, explain the package, overload;

11. Does OC have multiple inheritance?

12, understand table view, explain the principles of reuse

Describe the optimization method of table view sliding card

14, viewDidLoad and viewDidAppear call timing (the difference between one and more);

15. How to pass values between pages (public properties, public methods and protocols, block values, notifications, extern global variables, NSUserDefault simple data store values);

What’s the difference between a notification and a delegate?

17. Are notifications sent and received in the same thread?

18. What are the differences between HTTP and HTTPS?

19, OC multithreading in general there are several solutions?

20. Do you know NSURLConnection and Session?

21, describe the implementation principle of NSURLSession

22, HTTP header code. ;

Programming: to achieve a binary tree inversion.

Byte two side content:

1, tiger eating sheep problem. (In game theory, the tiger wants to eat the sheep, assuming that all tigers are rational, that is, firstly to survive, and secondly to be full, the tiger will become a sheep after eating the sheep and will also be eaten by other tigers. Now, if you have N tigers and 1 sheep, what is the number of times that the tigers will eat the sheep? Dynamic programming problem, odd to eat, even not eat.

2. Frog jump lattice, Fibonacci sequence; Frog hop lattice, Fibonacci sequence;

3. Familiar with what framework to use?

4, if you let yourself implement SDWebImage secondary storage mechanism, what do you do?

5, @autorelease{NSString s; } and nsstrings s; What’s the difference?

Describe your understanding of autorelease.

7. What is your understanding of HTTP?

Do you know the HTTP return status code?

9. Why is HTTP stateless?

10. Why not use native APNS technology?

11. Do you know the COMMUNIST Party?

12. What is the difference between dispatch_group_t and dispatch_barrier_sync?

13. Do you know NSOperation?

14. Do you know NSOperationQueue?

Bytes on three sides:

1, algorithm: only three elements of the array in order to arrange, the time complexity requires O(n);

2. What do you understand about compiling and linking OC programs?

3. What about memory management?

4. How does the response chain work?

5. Follow-up: Did hitTest try to rewrite?

6. Do you know about HTTP, session and cookie?

What is the relationship between threads and queues?

What about CALayer and UIView?

Thirteen: iOS advanced interview, each big factory and small company interview questions!

preface

The recent iOS interview has experienced a small wave of climax, without further words, to cut to the chase, here is my summary of some of the 2020 interview questions for large companies and small companies!

directory

  • 1, iOS basic questions
  • 2, iOS actual combat problem
  • 3
  • 4, computer system problem
  • 5, design mode
  • 6. Structure & Design
  • 7, data structure & algorithm problem

1, iOS basic 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. How to implement atomic Why can’t it be absolutely thread-safe (preferably in context)?

3. What happens when an object that has been “weak” is released? How does it work? Do you know sideTable? Can you draw the structure inside?

4. What data structures are used by Autoreleasepool? AutoreleasePoolPage

5. 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?

6, how many methods of introspection in iOS? What’s the difference between a class method and an objc_getClass method?

7. What does RunLoop do? Do you know the inner workings of it? (Preferably in conjunction with thread and memory management)

8, which scenes can trigger off-screen rendering? (Say what you know)

2, iOS actual combat problem

1. What are some scenarios that NSOperation is easier to implement than GCD? (or the points NSOperation is better than GCD, tell as many as you know)

2. App startup optimization strategy? It is better to talk about the process of starting main() before and after the execution of the function.

3. Do you understand the idea of non-trace burial of App? What characteristics do you think an ideal non-trace buried point system should have? (Say what you know)

4. What situations do you know will cause app crash, and what methods can be used to intercept and resolve them? (Say what you know)

5. What situations do you know will lead to app shutdown? What methods can be used to avoid it? (Say what you know)

3

1. What are the optimization strategies for the App network layer?

2. Why does TCP use three handshakes and four waves?

3. HTTPS handshake process? Why do you need asymmetric encryption for key delivery? Do you understand two-way authentication?

4, how does HTTPS implement authentication and authentication integrity?

5. How to catch HTTPS packets with Charles? What is the principle and process?

4, computer system problem

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 is the difference between static and const?

4. When do deadlocks occur? How to avoid it?

5. 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

5, design mode

1. What design patterns do you know besides singletons and observer design patterns? To introduce each of them

2. What design patterns are practiced in the iOS SDK?

3. What is the composition and working mechanism of the design pattern?

6. Structure & Design

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 techniques? 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 seen the source code, 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.)

7, 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 the hash table implemented? How do I resolve address conflicts?

3, sort questions: bubble sort, choice sort, insertion sort, quick sort (2, 3) 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 the binary tree? How do I verify that two binary trees are exactly equal?

conclusion

However, a good interview can’t be done without technical support. While looking for a job, don’t forget to improve your skills. I hope I can find a satisfying job as an iOS developer.

14: [iOS Interview] Well-Known Internet companies iOS interview questions

Apes counselling 3.2

  1. Component architecture introduction?
  2. WKWebViewWhiteboard problem? How to receiveWKWebViewCollapse?OCwithJSHow to interact? How to ensureJSreceivedOCIs the execution successful? (Interactive reliability)
  3. App crashInformation collection, and how to ensure itappNot collapse?
  4. Log system build? Real-time log upload or delayed log upload?
  5. SwiftHow to implementKVO?
  6. GCDMaximum number of concurrent threads? (using thedispatch_semaphore) and manually implement maximum queue concurrency
  7. Algorithm:
  • Removes duplicate elements from a sorted list
  • Adding integer strings (consider carrying)

3.4 good future

  1. For inAdd or delete elements within the loop, causing problems?
  2. Accurate statisticsViewControllerPage load time fromviewdidload->viewdidappear?
  3. wkwebviewPerformance optimization

Shell house hunting 3.5

  1. Anti-cheating scheme in the project
  2. Consideration of componentization technology selection (advantages and disadvantages of URL scheduling scheme),target-actionAdvantages and disadvantages of the component solution
  3. runtimetheisa,weakinruntimeThe structure of: withweakmodifiedobjthekeyandvalueWhat are they?
  4. categorytheruntimeWhy can’t we add member variables to structures: Member variables are determined at compile time and cannot be modified at run time
  5. autoreleasepoolUnderlying principles,autoreleasepoolpageThe structure of the

3.7 well quickly

  1. LoadMethod call timing, when is it added toruntime?AClass callBClass,AHas not beenimport.BbeAimportthatAandBtheload,initializeIs the method called?
  2. httpsandhttpThe difference between?sslWhat is? withtlsThe difference between?
  3. RealmDatabase underlying implementation principle?coredataIs it a database? What is the difference between an object database and a relational database?
  4. Algorithm: merge sort
  5. For cross-platform development such asflutter,React NativeOpinion?

Fifteen: Dacang often asked iOS interview questions summary!

Runloop & KVO

runloop

  1. How does the app receive touch events
  2. Why only the main threadrunloopIs open
  3. Why only refresh the UI on the main thread
  4. PerformSelectorandrunloopThe relationship between
  5. How do I keep threads alive

KVO

  1. Realize the principle of
  2. How do I manually close kVO
  3. Does KVO trigger when a property is changed through KVC
  4. Under what circumstances will KVO crash and how to prevent it
  5. Advantages and disadvantages of KVO

Runtime Related Issues

Structural model

  1. Introduce runtime’s memory model (ISA, object, class, metaclass, structure storage information, etc.)
  2. Why design Metaclass
  3. class_copyIvarList & class_copyPropertyListThe difference between
  4. class_rw_tclass_ro_tThe difference between
  5. categoryHow is it loaded, two categoriesloadThe order in which methods are loaded, the order in which methods of the same name in both categories are loaded
  6. category & extensionDifference, can I add an Extension to NSObject? What’s the result
  7. Message forwarding mechanism, the advantages and disadvantages of message forwarding mechanism and other language message mechanisms
  8. When the method is called,Method Query -> Dynamic resolution -> Message forwardingWhat did you do
  9. IMP,SEL,MethodThe differences and usage scenarios
  10. load,initializeWhat’s the difference between methods? What’s the difference in the inheritance relationship
  11. Talk about the pros and cons of message forwarding

Block

  1. blockWhat does the structure look like
  2. Is block a class? What are the types
  3. aintVariables are__blockEmbellished or not? Block
  4. blockIn the modifiedNSMutableArray, whether it needs to be added__block
  5. How does memory management work
  6. blockYou can usestrongModified?
  7. Why use it when solving circular references__strong, __weakmodified
  8. blockhappencopyThe timing
  9. BlockTo access the object typeAuto variableWhen theThe ARC and MRCWhat’s the difference

multithreading

Mainly the COMMUNIST Party

  1. iOSHow many types of threads are there in development? Respectively compared
  2. GCDWhich queues are available and which queues are provided by default
  3. GCDWhat are the method apis
  4. GCDThe relationship between main thread and main queue
  5. How do you do it, and in as many ways as you can
  6. dispatch_onceRealize the principle of
  7. Under what circumstances does a deadlock occur
  8. This section describes the types of thread locks and their application scenarios
  9. NSOperationQueueIn themaxConcurrentOperationCountThe default value
  10. NSTimer, CADisplayLink, dispatch_source_tThe advantages and disadvantages of

Performance optimization

How do you do startup optimization, how do you monitor how do you do lag optimization, how do you monitor how do you optimize power consumption, how do you monitor how do you optimize network, how do you monitor

Architecture design

  1. Manual burial point, automatic burial point, visual burial point
  2. MVC, MVP, MVVMDesign patterns
  3. Common design patterns
  4. The downside of singletons
  5. Common routing schemes and their advantages and disadvantages
  6. If the stability of the project is guaranteed
  7. Designing an Image Caching Framework (LRU)
  8. How to design agit diff
  9. Designing a thread pool? Draw your architecture diagram
  10. What is your app architecture, what are the pros and cons, why, and how to improve it

Data structures and algorithms

  1. Eight Sorting algorithms
  2. The stack and queue
  3. String processing
  4. The list
  5. Operations related to binary trees
  6. Deep search search
  7. Basic dynamic programming, greedy algorithm, binary search

conclusion

These are collected in the recent interview some common questions, welcome you to leave more questions and answers!

16: iOS interview Assistance for iOS test set

preface

IOS interview assist does not target any interview questions, it is just to share the interview questions that may appear when brushing the questions, we find out the omissions and fill in the gaps, review the old and learn new. Hope to provide you with a real help.

The title

1. Talk about the reflex mechanism of OC;

2. What is the essence of block? How many blocks are there? How does the distinction come about?

3. Why can a __block-modified variable change its value inside a block?

Talk about communication between threads.

5. What is the crash rate of your app?

6. Talk about the hash algorithm.

What is the implementation principle of NSDictionary?

8. How does your App handle local data security (such as user name and password)?

9. Have you ever encountered a BAD_ACCESS error? How did you debug it?

10. What are pointer constants and constant Pointers?

11. How to exchange the values of two variables without borrowing the third variable? Manual writing of the exchange is required.

If you were to design a notification center, how would you design it?

13. How to design a scheme to deal with the field interface that changes frequently in the back end?

14, KVO, KVC implementation principle

15. Use the recursive algorithm to find the sum from 1 to n

16. Why can’t A category add attributes?

17. Describe the relationship between runloop and threads.

18. How autoreleasePool works.

What about the simple factory pattern, the factory pattern, and the abstract factory pattern?

How to design a network request library?

Talk about multithreading, how do you usually use it?

How do you optimize UITableViewCell?

23. Which tripartite libraries have you seen? Talk about how it works and what’s good about it?

24, Describe the HTTP protocol and the meaning of the frequently used code.

25. Design a cache strategy.

26. Design a scheme to detect the main line and lag.

27. Talk about Runtime, how is work used? Have you seen the runtime source code?

28. Give some examples of thread safety you have used in your work.

29. Which locks have you used? Which locks have higher performance?

What about the HTTP and HTTPs request process?

31. Talk about TCP and UDP

32. Describe the difference between static and dynamic libraries

When are the load and initialize methods called?

34. In which thread does NSNotificationCenter send notifications?

35. Have you ever used SWIFT? If not, do you usually study?

36. Describe your understanding of architecture?

37, Why must update UI in main thread?

Small benefits:

IOS Interview Collection + Answers (1-5) (Juejin.cn)

A learning route for iOS Developers (QQ.com)

Keep updating! If you like it, please like it and pay attention to it! Thank you very much!