iOS Interview Questions and Answers

Thumb

Author

BIQ

Questions

64

Last updated

Feb 10, 2022

iOS, formerly known as iPhone OS, is a mobile OS created and developed by Apple for its hardware. This operating system powers most of Apple’s devices, including iPhones, iPads, and iPod Touch. iOS is the world’s second most popular mobile OS after Android. The iOS UI is based on direct manipulation by using multi-touch. Apple has been active in including accessibility functions into iOS that even enable users with vision and hearing disabilities to use its products properly. If you have read our IOS interview questions, you can find your next dream job soon.

Advantages

  • User-friendly
  • Intuitive and fluid responsive
  • Excellent UI that works equally good for all purposes - media entertainment, gaming and business.
  • Less heat generated as compared to Android.
  • Best-in-class security.

Most Frequently Asked iOS Interview Questions

Here in this article, we will be listing frequently asked iOS Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q1. What are the CPU architectures supported by iOS devices?
Answer
There are CPU designs upheld by IOS gadgets:-

iPhones and Ipads

  • Arm64 is the current 64-bit ARM CPU design, as utilized since the iPhone 5S and later (6, 6S, SE and 7), the iPad Air, Air 2 and Pro, with the A7 and afterward chips.
  • armv7s (a.k.a. swift, not to be confused with the language of a similar name), is utilized in Apple's A6 and A6X chips on iPhone 5, iPhone 5C and iPad 4.
  • armv7, a first variation of the 32-bit ARM CPU, as utilized in the A5 and prior.

TvOS

  • On tvOS, Elements underpins three structures for gadget sending:
  • arm64 is the current 64-bit ARM CPU design and utilized on Apple TV 4
  • x64_64 (i.e., 64-bit Intel) is utilized in the Simulator

WatchOS

  • On tvOS, Elements underpins three designs for gadget arrangement:
  • Armv7k is a 32-bit variation of standard armv7 and utilized on Apple Watch Series 0, 1 and 2.
  • i386 (i.e., 32-bit Intel) is utilized in the Simulator
Q2. What iOS version onwards ARC can be used?
Answer

ARC is an IOS 5 specific feature and using storyboard means that you need to raise minimum supported OS to IOS 5.

Q3. Can we support the same application for iPhone 3GS and iPhone 5, 6, 7? Why not?
Answer

We cannot support the same application for iPhone 3GS AND 5, 6, 7 because iPhone 3GS doesn’t support IOS6 or later versions.

Q4. Would I be able to keep in touch with some C++ work in the equivalent .m record? Will it compile? Assuming no, what changes would it be a good idea for me to do to compile it?
Answer

The easiest solution is to inform Xcode to compile everything as Objective C++ merely. Set your target on the settings to Compile Sources As to Objective C++ and recompile. After that use C++ or Objective C anywhere you want.

Q5. What are the sorts of iOS binaries you can make utilizing Xcode?
Answer

you can create .app, .ipa, .a and .framework.

Q6. Can a static library (.a) contain assets like pictures, sound documents and so on.?
Answer

NO, You can’t offer something aside from code with a static library. This is often as a result of .a files measure an accessible archive of object files, with the extra ability beneath Mac/iOS of supporting multiple processor architectures.

Q7. What is the responder chain?
Answer

The responder chain is a series of coupled responder objects. It starts with the primary responder and finishes with the app object. If the primary responder cannot handle an occurrence, it forwards the event to consecutive responder within the responder chain.

Q8. Tell me the hierarchy of UIButton.
Answer

NSObject -> UIResponder ->UIView -> UiControl ->UIButton.

Q9. Why UIControl is provided if we can create custom UIView?
Answer

You can additionally produce a custom read to encapsulate the visual appearance and behavior of your own reusable element. For instance, in a very news reading application, we would desire a standard part to show pictures with a caption employing a consistent style on each the home page view controller similarly individual story view controller.

Q10. App Life Cycle.
Answer

An app in iOS goes through completely different states as it runs. These shows the states of the appliance life cycle. Below are the states of the associate app.

  • Not running

The application has not been running or was launched however was terminated by the system.

  • Inactive

The app is running within the foreground; however, it is presently not receiving events. (It is also death penalty alternative code though) the associate app typically stays during this state because it transitions to a distinct state.

  • Active

The app is running within the foreground and is receiving events. This is often the conventional mode for foreground apps.

  • Background

The app is within the context and executing code. Most apps enter this state shortly on their way to being suspended. However, an associate app that requests additional execution time might stay during this state for an amount of your time. Additionally, an app being launched directly into the background enters this state rather than the inactive state. For info concerning the way to execute code whereas within the environment, see Background Execution.

  • Suspended

The app is within the background; however, executing code isn’t. The system moves apps to the current state mechanically and doesn't send word them before doing this. Whereas suspended, the associate app remains in memory however doesn't execute any code.

Q11. ViewController Lifecycle.
Answer

While the view controller lifecycle is about the controller itself, for the most part, significant to how its root see, that UIView instance, shows up and vanishes onto the screen. I will be explicitly discussing the view controller lifecycle, and it’s relating techniques

Q12. What are the lifecycle events of UIViewController?
Answer
There are some events of the UI view controller:-
  • LoadView

This event creates the view that the controller manages. It’s only known as once the view controller is made programmatically. This makes it a superb place to create your views in code.

  • LoadViewIfNeeded

If just in case the reader of current viewController has not been set nevertheless then this methodology can load the view; however bear in mind, this is often solely out there in iOS >=9.0. Thus if you're supporting iOS <9.0 then do not expect it to come back into the image.

  • ViewDidLoad

The viewDidLoad event is merely known as once the view is made and loaded into memory. However, the bounds for the view aren't outlined nevertheless. This is often a superb place to initialize the objects that the view controller goes to use.

  • ViewWillAppear

This event notifies the view Controller whenever the view seems on the screen. During this step, the read has bounds that are outlined. However, the orientation isn't set.

  • ViewWillLayoutSubviews

This is the primary step within the lifecycle wherever the boundaries are finalized. If you're not victimization constraints or Auto Layout, you most likely wish to update the subviews here. This is often solely out there in iOS >=5.0. Thus if you're supporting iOS <5.0 then do not expect it to come back into the image.

  • ViewWillLayoutSubviews

This event notifies the view controller that the subviews are got the wind off. It’s a superb place to form any changes to the subviews once they need to be set. This is often only out there in iOS >=5.0. Thus if you're supporting iOS <5.0 then do not expect it to come back into the image.

  • ViewDidAppear

The viewDidAppear occasion fires after the view are introduced on the screen. Which makes it an amazing place to get information from a backend administration or database.

  • ViewWillDisappear

The ViewWillDisappear occasion fires when the perspective on introduced see controller is going to disappear, reject, spread or hole up behind other viewController. This is a correct place where you can confine your system calls, negate clock or discharge objects which are bound to that viewController.

  • ViewDidDisappear

This is the final step of the lifecycle that anybody can address as this occasion fires soon after the perspective on exhibited see controller has been disappeared, rejected, secured or covered up.

Q13. What JSON Framework supported by iOS?
Answer

SBJson structure is upheld by iOS. It is a JSON parser and generator for Objective-C. SBJson gives adaptable APIs and extra control that makes JSON taking care of simpler.

Q14. Name the framework that is used to construct application’s user interface for iOS?
Answer

You can use the UIKit framework to develop application’s UI. This framework provides drawing model, event handling, views, windows and controls, designed for touch screen interfaces.
This framework provides essential infrastructure for constructing and managing iOS apps, such as view and window architecture for managing user interface, event handling infrastructure to respond to user input, and a model to drive run loop and communicate with the system.

Q15. What is Category and class extension? How these differ?
Answer

Category: You rarely utilize a classification to add strategies to a current class, for example, one characterized in the Cocoa systems. The consolidated procedures are acquired by subclasses and are vague at runtime from the first techniques for the class. You can likewise utilize classifications of your own classes to Distribute the usage of your private classes into independent source files — for example; you could assemble the techniques for an expansive class into a few classes and put every class in an alternate record. Announce private procedures.

Extension - Extensions add new usefulness to a current class, structure, count, or convention type. This incorporates the capacity to broaden types for which you do not approach the original source code (known as retroactive demonstrating). Expansions are like classifications in Objective-C. (Unlike Objective-C types, Swift extensions do not have names.)

Q16. What is the purpose of reuseIdentifier? What is the benefit of setting it to a non-nil value?
Answer

It groups together similar rows that differ in content, but have similar layouts in a UITableView. A UITableView allocates sufficient UITableViewCell objects to just display the content that is visible in the table.
If you set reuseIdentifier to non-nil value, then UITableView will attempt to reuse an allocated UITableViewCell using the same reuseIdentifier when you scroll the table view.
If you do not set the reuseIdentifier, the UITableView will allocate new UITableViewCell objects for new items that will scrolls into view.

Q17. Differentiate ‘app ID’ from ‘bundle ID.’ Explain why they are used?
Answer

An App ID is a two-section string want to build up one or a lot of applications from one advancement group. The string comprises of a Team ID, and a pack ID seeks string, with a period (.) isolating the 2 components. The Team ID is provided by Apple and is exclusive to a selected development team, whereas the bundle ID search string is provided by the developer to match either the bundle ID of one app or a collection of bundle IDs for a bunch of apps. As a result of the majority consider the App ID as a string, they suppose it's interchangeable withBundle ID.

It seems this manner as a result of once the App ID is formed within the Member Center, you merely ever use the App ID Prefix that matches the Bundle ID of the applying Bundle. The bundle ID unambiguously defines every App. it's laid out in Xcode. One Xcode project will have multiple Targets and thus output different apps. A typical use case for this can be associate degree app that has each lite/free and pro/full versions or is branded in various ways that.

Q18. What are the different types of iOS Application States: Not running, Inactive, Active, Background, Suspended.
Answer
The application has not been propelled or was running but instead was ended by the framework.
  • Inactive

The application is running in the foreground area yet is presently not getting events. It might execute other code, however. An application typically remains in this state just quickly as it changes to an alternate state.

  • Active

The application is running in the foreground area and is accepting events. This is the ordinary mode for frontal area applications.

  • Background

The application is out of sight and executing code. Most applications enter this state quickly on their approach to being suspended. In any case, an application that demands additional execution time may stay in this state for a timeframe. What's more, an application being launched directly into the background enters this state rather than the idle state. For data about how to execute code while out of sight, see Background Execution.

  • Suspended

The application is in the background yet isn't executing code. The framework moves applications to this state naturally and does not inform them before doing as such. While suspended, an application stays in memory yet does not execute any code.

Q19. What major changes released in iOS7, iOS8, iOS9+?
Answer
Q20. Does Objective C have function overloading?
Answer

Objective-C doesn't support technique overloading. Thus you have got to use totally different technique names.

Q21. What is the difference between overloading and overriding?
Answer
  • Overloading happens once 2 or a lot of ways in one category have a similar technique name; however totally different parameters. But overriding suggests that having 2 ways with a similar technique name and parameters
  • The real object type within the run-time, not the reference variable type, determines that the overridden technique is employed at runtime. In distinction, reference sort defines that overladen procedure is going to be used at compile time.
  • Polymorphism applies to overriding, to not overloading.
  • Overriding may be a run-time idea whereas overloading may be a compile-time idea.
Q22. What is messaging? How does the runtime handle message passing? What is message forwarding?
Answer
Q23. Does Objective C have multiple inheritances? Why not? How to imitate various inheritances?
Answer

Objective-C does not support multiple inheritances. You’ll use a protocol, composition and message forwarding to attain a similar result.

Multiple inheritances allow a category to inherit behaviors and options from over one parent. However, issues will arise with multiple inheritances as a result of it permits for ambiguities to occur. Because of this, Objective-C will don’t implement various inheritances.

Q24. Who calls the dealloc strategy? Would we be able to implement dealloc in ARC? In the event that indeed, what is the need to do that?
Answer

Dealloc is termed as a result of memory management. Once an objects “retainCount” reaches zero, then a dealloc message is mechanically sent there to object. You should never decision dealloc on objects unless it's a decision to [super dealloc]; at the tip of Associate in Nursing overridden dealloc.

Overridden dealloc.

(Void) dealloc

{

[ivar release]; //Release any retained variables before super dealloc

[super dealloc]; //Only place in your code you should ever call dealloc

}

Q25. How do you check if your code has memory leaks?
Answer
There are some ways to ascertain or observe memory leaks: -
  • FBRetainCycleDetector

It is an open source library launched by Facebook in 2016 F8 Conference. Its goal is to observe all doable retain cycles in Objective-C codebase throughout the runtime.

  • Debug Memory Graph

Actually, Xcode offers us a native way — debug memory graph to observe memory leaks. It a tool initial introduced in Xcode eight and is ready to grab leaks like retain cycles

  • Allocations and Leaks Instrument

Instruments are powerful debugging and identification tools that come packaged with Xcode. For memory problems, we have a tendency sometimes to use allocations and leaks tools. Allocations instrument tracks all of the objects that app allocates over the course of its run; leaks instrument checks all memory and figures out the leaked objects. Compared to rectify memory graph, these instruments provide a lot of in-depth check out memory leaks.

Q26. Ideas of notification center, nearby and remote notifications?
Answer

Notification center is a mechanism that allows the publisher of knowledge to registered observers. Objects register with a notification center to receive notifications (NSNotification objects). Once associate object adds itself as an assistant observer, it specifies that notifications it ought to receive. The associate object might, therefore, the decision this methodology many times so as to register itself as an associate observer for many totally different notifications. Local notifications and remote notifications square measure ways that to tell users once new knowledge becomes on the market for your app, even once your app isn't running within the foreground. For instance, an electronic communication app would possibly let the user apprehend once a replacement message has arrived, associated a calendar app would probably inform the user of an impending appointment. The distinction between native and remote notifications is straightforward:

  • With native notifications, your app configures the notification details regionally and passes those details to the system that then handles the delivery of the information once your app isn't within the foreground. Native notifications square measure supported on iOS, tvOS, and watchOS.
  • With remote notifications, you utilize one amongst your company’s servers to push knowledge to user devices via the Apple Push Notification service. Remote warnings square measure supported on iOS, tvOS, watchOS, and macOS.
Q27. What is Dependency Management Tools : Cocoapods etc?
Answer
Q28. Common reasons for app rejection from App store review process?
Answer
  • Broken Links:

There are a couple of needed links as a part of the App Store application method. For example, your app must have a link to your privacy policy. You’ve additionally ought to have a link to app support in order that users will contact you. If these links don’t go anyplace, your app is rejected. Make sure these pages square measure in operating order before submission.

  • Bugs throughout the review method

Obviously, you wouldn’t need an automobile you were pondering shopping for to interrupt down on the check drive. That’s an excellent thanks to making sure that the automobile isn’t going get oversubscribed. By that very same token, a bug that rears its ugly head throughout the review method can place your app on the main road to rejection. Each app goes to possess some problems once it’s initial free, however, try and catch as several as available throughput testing to avoid rejections and delays.

  • Crashes throughout the review method

Moment dismissal anticipates your application on the off chance that it crashes all through the review technique. Obviously, the App Store is trying to find apps that truly work. If they don’t, they’re obtaining thrown the “no” pile.

  • Long loading times

Your app has precisely fifteen seconds to load, or Apple goes to reject it. you'll reduce your app load time by ensuring any pictures used square measure the adequate measure and prioritizing any bugs that reason the application to crash after loading. For a lot of insight in decreasing load times, examine this text on important. measure and prioritizing any bugs that reason the application to crash after loading.

  • Poor interface

Apps on the app store should supply worth and value to finish users. Apple is explicit regarding the top quality of its applications. Look to satisfy the high-level style demand of Apple, just as content size, content configuration, differentiate, arrangement, goals, mutilation, hit controls, association, and so forth. Cohesive user expertise is essential to obtain through the App Store.

  • Apps that square measure demos or in beta

Demos aren’t happy with the Apple App Store. Words like “demo,” “test” and “beta” square measure reaching to get flagged for rejection as a result of the App Store needs final versions of apps. This is often simply inevitable and best observe anyway. You don’t wish users are downloading associate imperfect version of your app.

  • Mistreatment non-public API

Apple is that the sole guy on the block which will use a private API. ALL Apple apps have to be compelled to use a public API so as to create it through the approval method. The rationale is that Apple needs to make sure that public arthropod genus square measure in use is to shield user knowledge from being abused.

  • Inappropriate ad identifiers

Ads square measure a part of the method of building a lot of apps, however, if you utilize IDFA (the iOS advertising identifier) on something that isn’t an advertisement, then you’re reaching to get rejected right away.

  • Unrelated keywords

Keywords square measure; however, users notice your app. However, mistreatment keywords that square measure incorrect or square measure unrelated to the particular mobile application square measure cause for fast rejection from Apple. It’s not legal to use proprietary words, or titles that square measure deceptive. Apps got to gift themselves honestly so as to create it through the app store approval method.

  • Inappropriate content

Gambling and creative activity don't seem to be allowed within the App Store.

  • Combination content

Content in mobile apps is supposed to be distinctive. Apps that square measure merely aggregates of content which will be found elsewhere square measure the net goes to induce kicked out by Apple. What goes informed any Apple application should be content that’s usable and original for finish users. Plagiarism and aggregation can get your app showed within the blink of a watch.

  • Offensive language

Apple is supposed to be a secure area for folks of all non-secular faiths, ages, orientations, etc. It’s ought to all be clean and on top of the board. Something that's meant to arouse anger or to elicit a violent reaction can get thrown out right away.

  • No privacy policy

It’s a tough and quick demand that each Apple app has a privacy policy in situ so as to induce approval.

  • Sharing personal user knowledge

Any app that shares personal user knowledge, from names to photos to contact info, are rejected. Privacy could be a massive deal to Apple, and they’ve created a large quantity of trust with users so as to spice up their whole and create the foremost out of their client loyalty. Incursive privacy is simply not allowed.

  • mistreatment Apple Pay while not the privacy policy

Another privacy policy issue is mistreatment Apple Pay while not the privacy policy for it. That features any of the weather of stigmatization or the interface generally.

  • Missing information

A major demand for apps within the Apple Store is that they need information. Meaning as well as screenshots, descriptions, etc. If the information isn’t there, then the app goes to induce rejected.

Q29. What Persistent storage used in Mobile Apps - iOS?
Answer

Persistent storage is keeping the information you are working with around. In software engineering, persistence refers to the normal for the expression that outlasts the procedure that made it. This is accomplished practically speaking by putting away the state as information in PC information storage. When it comes to information diligence in IOS, there are Five huge approaches to accomplish information steadiness:-

  • UserDefaults
  • Property List
  • SQLite
  • Keychain
  • CoreData
Q30. What is ORM?
Answer
Q31. What is Core Data?
Answer
Q32. How do you setup/initialise a core data stack in your application? Is this activity performed on main thread? If not, why?
Answer
Q33. What is NSPersistentStoreCoordinator? What duties does it perform?
Answer
Q34. What is NSPersistentStore? Is it thread safe?
Answer
Q35. What is NSManagedObjectContext? What are the different concurrency types? Explain them.
Answer
Q36. What is NSManagedObjectModel?
Answer
Q37. What is NSManagedObject?
Answer
Q38. Different types of persistent stores? Which all types can we have on iOS?
Answer
Q39. Can my application have multiple models? (Yes)
Answer
Q40. In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file? (Yes, Hint: configurations)
Answer
Q41. What are the different store migration options? When are they used? How do they work? What is mapping model?
Answer
Q42. Explain parent-child context setup. How does it work? What are the advantages?
Answer
Q43. What is difference between performBlock: and performBlockAndWait:?
Answer
Q44. Are the NSManagedObjectContext queues serial or concurrent?
Answer
Q45. Can you pass same core data objects between different threads and modify?
Answer
Q46. What performance issues can you face when using CoreData?
Answer
Q47. What is NSFetchedResultsController? How do you turn on content monitoring?
Answer
Q48. How to implement "load more" using NSFetchedResultsController? (Hint: Set fetch offset and fetch limit on the NSFetchRequest of the controller, change the request to fetch more results)
Answer
Q49. What are the different delete rules that a relationship can have? Which one takes ownership?
Answer
Q50. In NSFetchRequest can we fetch only a selective few attributes of an entity? How?
Answer
Q51. Can I have relationship between entities in separate stores (in case of configurations)? (No)
Answer
Q52. What are fetched properties? How do you create a fetched property?
Answer
Q53. Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?
Answer
Q54. When a NSFetchRequest fetches an entity object from store, does it fetch all of its data at once?
Answer
Q55. What is a fault?
Answer
Q56. What are transient properties?
Answer
Q57. How core Data Works to save data in Persistent storage?
Answer
Q58. What persistent storage Core data uses to save data?
Answer
Q59. How Core Data differs from SQLite?
Answer
Q60. Is Core Data is thread safe?
Answer
Q61. How to use Core Data Objects between two threads?
Answer
Q62. How to handle concurrency problems in Core Data?
Answer
Q63. What is NSUserDefaults?
Answer
Q64. What is plist?
Answer