-------------------------------------------
Q: 1. What was the latest version of iOS you worked with? What do you like about it and why?
A:
The purpose of this question is to inquire if the interviewee actually keeps up with the latest development from Apple.
Expected answer: he/she tells you what the latest version of the system is and what he/she has worked with lately. And tells you about one of the new features of the system that he/she is excited about (i.e. I love new multitasking on iPad because it’s going to make user experience way better and opens up a lot of opportunities for us developers to build new cool things, etc.).
---------------------------------------------
Q: 2. Have you worked with Swift? What do you like about it? What don't you like?
A: This question will give you a sense of several things:
is he cautious with using something as unstable as Swift. For example, 2.0/2.1 releases broke a lot of things/libraries and a senior developer would think twice about using Swift on a production application. Because a lot of libraries and frameworks necessary for production ready iOS development either do not exist yet in pure Swift or do not work anymore with newer versions of the language (as of today - 11/11/15).
whether the developer is bold enough to play with the cutting edge stuff
what’s his long terms plans and expectations (is he optimistic or pessimistic or somewhere in between)
Expected answer: be cautious, use Swift along with Objective-C for now and move to pure Swift down the road in several years when it and the ecosystem of libraries around it mature enough.
For now: Swift 3 has a lot of support from third party library
-----------------------------------------------
Q: 3. How is memory management handled on iOS?
A:
This question will give you an idea of how long the person was working with iOS, whether she/he’s a newcomer who’s worked only with ARC or he/she’s worked with manual retain count (MRC) and has a deeper knowledge/experience with memory management on iOS.
Expected answer: it is great if interviewee knows MRC but it is not necessary. More important that he/she understands strong, weak, assign, etc. directives on properties and can confidently tell you what those directives imply and how it’s handled with blocks.
-----------------------------------------------
Q: 4. What do you know about singletons? Where would you use one and where you wouldn't?
A: This is a typical objective oriented programming question. In the case of iOS, you can get a feel of how the interviewee is using it in his/her apps. You’ll be able to weed out those people who came from Java/PHP and such and use it as a “global” store or something similar.
Expected answer: singletons should be avoided and used only for objects that need to be shared throughout your application for same reason. It should be used carefully, instantiated lazily, if it’s possible, and passed into other objects as a dependency using Inversion of Control and Dependency Injection principles.
Red flag: is when the interviewee talks about global variables and stores.
-------------------------------------------------
Q: 5. Could you explain what is the difference between Delegate and KVO?
A:
With this question, you are assessing their knowledge of different types of messaging patterns used in iOS. A senior developer should’ve used both of those many times in his/her applications.
Expected answer: Both are ways to have relationships between objects. Delegation is a one to one relationship where one object implements a delegate protocol and another uses it and sends messages to assuming that those methods are implemented since the receiver promised to obey with the protocol. KVO is a one-to-many relationship where one object could broadcast a message and one or multiple other objects can listen to it and react.
--------------------------------------------------
Q: 6. How do you usually persist data on iOS?
A:
This will tell you if they just played with rudimentary ways to store data locally on iOS like NSUserDefaults, Plists, disk file storage, etc. or if they have used more advanced storages like Core Data and Realm. Ideally, they should know when it is appropriate to use all of the above persistence tools.
Expected answer: A senior developer should at least be able to tell you when it is appropriate to use NSUserDefaults, Core Data, and disk file storage. _**_Core Data is what you’re expecting them to explain you the most. Other possible options are Realm and similar third party (non-Apple) solutions but make sure they know why they would want to use them instead of Core Data. With Core Data they should be able to explain how it works and how it’s different from SQLite (i.e. it’s an object graph rather than a relational database, etc.).
---------------------------------------------------
Q: 7. How do you typically do networking?
A:
Networking is a vital part of almost any application these days. In fact, the majority of them is useless without an internet connection. Any decent iOS developer should know how to initiate various networking requests (GET, POST, PUT, DELETE, etc.) using Apple’s frameworks or third party tools such as AFNetworking.
Expected answer: Interviewee should be able to explain how to do not just basic networking but more advanced things like HTTP headers and token handling. But in general look for developers who use either AFNetworking or Alamofire or similar. The reason is these libraries are used very extensively by the iOS community and are utilized in many other tools. A senior developer should be able to utilize that instead of reinventing a wheel.
----------------------------------------------------
Q: 8. How do you serialize data on iOS (JSON from the web or local app data to Core Data and other storages) ?
A:
Data serialization is an important task for every iOS application. JSON is defacto standard of data serialization on the web and every developer should know how to effectively work with it without spending a lot of time writing boilerplate code. Same applies to data serialization for local storage. It can be handled in multiple ways but a good developer should at least be aware of the challenges with these tasks.
Expected answer: This is a tricky question. A naive developer would say that he/she parses JSON data using Apple’s NSJSONSerialization and then takes the resulting dictionary and assigns the data from each key to respective properties on his/her model object. This is not what you expect a senior developer to tell you. Senior developer should be aware of the issues that could arise with data serialization such as data validation and conversion. A good answer would be clear understanding that in general there are two types of data serialization: JSON to domain model, and domain model to persistence. Utilization of pods like Mantle or ObjectMapper or a similar library/pod is expected.
------------------------------------------------------
Q: 9. What design patterns do you know and use on iOS?
A:
This could be a very simple or a very complicated answer. Every iOS developer should know about MVC but if you’re looking for a senior developer than he/she should have a lot of patterns and best practices on how to organize code under his belt.
Expected answer: at least MVVM. This is the holy grail that saves iOS developers from Massive View Controllers. A senior developer should be able to explain to you what MVVM is, why it’s better than MVC, and should be able to tell you what other patterns he/she uses along with MVVM (Inversion of Control, Dependency Injection, etc.).
Red flags: if interviewee tells you that he uses only MVC because Apple said so and he/she never tried MVVM than that person is definitely not a senior iOS developer.
-------------------------------------------
Q: 10. What is Autolayout?
A:
Autolayout is one of the technologies on iOS that helps us build scalable UI that can be used on many devices of different shape and size. This is a must-know for any iOS developer, especially for a senior one.
Expected answer: do not expect proficiency with this technology but the interviewee should be able to tell you when and how he/she would use it and what benefits it gives them (i.e. scalable adjustable declarative UI).
------------------------------------------
Q: 11. How do you handle async tasks?
A:
Asynchronous programming is a vital part of any iOS application. Networking, local storage, and other heavy computation tasks should be handled in the background to avoid blocking UI and having users wait or system-kill your application.
Expected answer: answers to this questions may vary from NSOperations and GCD to Promises and RAC. A good developer knows multiple ways to execute async operations and knows when they are necessary (i.e. with networking, local persistence, etc. see above). From a senior developer though we expect a higher and broader level of tools they use such as ReactiveCocoa and PromiseKit.
-----------------------------------------
Q: 12. How do you manage dependencies?
A:
Dependencies management is a vital but daunting task. It was very difficult and error prone to do before but these days we have several tools to help us out with it. Every iOS dev should know how to handle dependencies and collaborate with other teammates.
Expected answer: CocoaPods and/or Carthage. Red flags: if the say that they don’t use any dependency manager and just copy files to the project folder. Also, a red flag if the use git submodules (it leads to project configuration issues and inconsistencies between local setups for different developers on the team).
--------------------------------------------
Q: 13. How do you debug and profile things on iOS?
A:
No one writes perfect code and debugging and profiling is one of the tools that we use to figure out the right technical solution. On iOS, we have all the typical “manual” debugging tools such as NSLog/print functions to output things in the console. But Apple also provides us with a more advanced variety of tools and instruments to help with identifying where problems lie.
Expected answer: every iOS developer should be able to explain how he/she would use breakpoints and logs to get the runtime data but from a senior developer you should expect to hear things about Instruments and Crash Logs.
--------------------------------------------
Q: 14. Do you code review?
A:
Code reviews are one of the most effective development methodologies. It helps understand the problem better, share knowledge, share techniques, catch bugs, share ownership of the codebase, etc. This style of development is not for everyone but every development should be able to do that effectively.
Expected answer: senior developer should be more or less proficient in this type of code collaboration. Again, this is not for everyone (depends on personality, compatibility, and other factors), but that is a skill that should show you if the candidate is able to work with other people and communicate his thoughts and ideas clearly to another teammate.
-------------------------------------------
Q: 15. Do you test your code? What do you do to make your code testable?
A:
This is embarrassing but we admit that we don’t do testing as much as we should. We know we really really should do it more. We are talking about Unit Testing and Integration Testing specifically here.
Expected answer: there is only one right answer here: either they do it or they wish they would. In general iOS community isn’t as big on testing as say Ruby community. Partially it is due to inherited lack of testing culture and partially due to lack of good tools for testing but things seem to be improving on that front.
-------------------------------------------
Development Basics
Q 16. Where can you test Apple iPhone apps if you don’t have the device?
A:
iOS Simulator can be used to test mobile applications. Xcode tool that comes along with iOS SDK includes Xcode IDE as well as the iOS Simulator. Xcode also includes all required tools and frameworks for building iOS apps. However, it is strongly recommended to test the app on the real device before publishing it.
Q 17. Does iOS support multitasking?
A. detailed multitasking iOS_Concept Q17
iOS 4 and above supports multi-tasking and allows apps to remain in the background until they are launched again or until they are terminated.
Q 18. Which JSON framework is supported by iOS?
A. JSONserialization is the JSON parse in the iOS SDK.
For the third party library, we can use SwiftyJSON. it provide flexible APIs and make JSON handling easier to get specific key.
Q 19. What are the tools required to develop iOS applications?
A. iOS development requires Intel-based Macintosh computer and iOS SDK.
Q 20. Name the framework that is used to construct application’s user interface for iOS.
A. The UIKit framework is used to develop application’s user interface for iOS. UIKit framework provides event handling, drawing model, windows, views, and controls specifically designed for a touch screen interface.
Q 21. Name the application thread from where UIKit classes should be used?
A. UIKit classes should be used only from an application’s main thread.
Note: The derived classes of UIResponder and the classes which manipulate application’s user interface should be used from application’s main thread.
Q 22. Which API is used to write test scripts that help in exercising the application's user interface elements?
UITest for user interface automation test?
XCTest for unit test?
A. UI Automation API is used to automate test procedures. Tests scripts are written in JavaScript to the UI Automation API. This in turn simulates user interaction with the application and returns log information to the host computer.
App States and Multitasking
Q 23. Why an app on iOS device behaves differently when running in foreground than in background?
A. An application behaves differently when running in foreground than in background because of the limitation of resources on iOS devices.
Other details?
Q 24. How can an operating system improve battery life while running an app?
A. An app is notified whenever the operating system moves the apps between foreground and background.
The operating system improves battery life while it limits what your app can do in the background.
This also improves the user experience with foreground app.
Q 25. Which framework delivers event to custom object when app is in foreground?
A. The UIKit takes care of delivering events to custom objects. As an app developer, you have to override methods in the appropriate objects to process those events.
APP States
Q 26. When an app is said to be in not running state?
A. An app is said to be in 'not running' state when:
- it is not launched.
- it gets terminated by the system during running.
Q 27. Assume that your app is running in the foreground but is currently not receiving events. In which sate it would be in?
A. An app will be in InActive state if it is running in the foreground but is currently not receiving events. An app stays in InActive state only briefly as it transitions to a different state.
Q 28. Give example scenarios when an application goes into InActive state?
A. An app can get into InActive state when the user locks the screen or the system prompts the user to respond to some event e.g. SMS message, incoming call etc.
Q 29. When an app is said to be in active state?
A. An app is said to be in active state when it is running in foreground and is receiving events.
Q 30. Name the app sate which it reaches briefly on its way to being suspended.
A. An app enters background state briefly on its way to being suspended.
Q 31. Assume that an app is not in foreground but is still executing code. In which state will it be in?
A. Background state.
Q 32. An app is loaded into memory but is not executing any code. In which state will it be in?
A. An app is said to be in suspended state when it is still in memory but is not executing any code.
Q 33. Assume that system is running low on memory. What can system do for suspended apps?
A. In case system is running low on memory, the system may purge suspended apps without notice.
Terminate?
Q 34. How can you respond to state transitions on your app?
A. On state transitions can be responded to state changes in an appropriate way by calling corresponding methods on app's delegate object.
For example:
applicationDidBecomeActive method can be used to prepare to run as the foreground app.
applicationDidEnterBackground method can be used to execute some code when app is running in the background and may be suspended at any time.
applicationWillEnterForeground method can be used to execute some code when your app is moving out of the background
applicationWillTerminate method is called when your app is being terminated.
Q 35. List down app's state transitions when it gets launched.
A. Before the launch of an app, it is said to be in not running state.
When an app is launched, after transitioning briefly through the inactive state, it moves to the active or background state.
Q 36. Who calls the main function of you app during the app launch cycle?
A. During app launching, the system creates a main thread for the app and calls the app’s main function on that main thread. The Xcode project's default main function hands over control to the UIKit framework, which takes care of initializing the app before it is run.
Core App Objects
Q 37. What is the use of controller object UIApplication?
A. Controller object UIApplication is used without subclassing to manage the application event loop.
It coordinates other high-level app behaviors.
It works along with the app delegate object which contains app-level logic.
Q 38. Which object is create by UIApplicationMain function at app launch time?
A. The app delegate object is created by UIApplicationMain function at app launch time. The app delegate object's main job is to handle state transitions within the app.
?? Q 39. How is the app delegate is declared by Xcode project templates?
A. App delegate is declared as a subclass of UIResponder by Xcode project templates.
Q 40. What happens if UIApplication object does not handle an event?
A. In such case the event will be dispatched to your app delegate for processing.
Q 41. Which app specific objects store the app's content?
A. Data model objects are app specific objects and store app’s content. Apps can also use document objects to manage some or all of their data model objects.
Q 42. Are document objects required for an application? What does they offer?
A. Document objects are not required but are very useful in grouping data that belongs in a single file or file package.
Q 43. Which is the super class of all view controller objects?
A. That is UIViewController class. The functionality for loading views, presenting them, rotating them in response to device rotations, and several other standard system behaviors are provided by UIViewController class.
Q 44. What is the purpose of UIWindow object?
A. the UIWindow object coordinate and present views on a screen.
Q 45. How do you change the content of your app in order to change the views displayed in the corresponding window?
A. To change the content of your app, you use a view controller to change the views displayed in the corresponding window. Remember, window itself is never replaced.
Q 46. Define view object.
A. Views along with controls are used to provide visual representation of the app content. View is an object that draws content in a designated rectangular area and it responds to events within that area.
Q 47. You wish to define your custom view. Which class will be subclassed?
A. Custom views can be defined by subclassing UIView.
Q 48. Apart from incorporating views and controls, what else an app can incorporate?
A. Apart from incorporating views and controls, an app can also incorporate Core Animation layers into its view and control hierarchies.
Q 49. What are layer objects and what do they represent?
A. Layer objects are data objects which represent visual content. Layer objects are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.