An Overview of iOS
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.
iOS was unveiled in 2007 by Apple for its iPhone. Since then versions have been released annually.
Latest Version: The latest version is iOS 12, which was released in September 2018. Memorize this information for IOS interview questions and answers.
- 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.
iOS Interview Questions and answers
- What are the CPU architectures supported by iOS devices?
- What iOS version onwards ARC can be used?
- Can we support the same application for iPhone 3GS and iPhone 5, 6, 7? Why not?
- 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?
- What are the sorts of iOS binaries you can make utilizing Xcode?
- Can a static library (.a) contain assets like pictures, sound documents and so on.?
- What is the responder chain?
- Tell me the hierarchy of UIButton.
- Why UIControl is provided if we can create custom UIView?
- App Life Cycle.
- ViewController Lifecycle.
- What are the lifecycle events of UIViewController?
- What JSON Framework supported by iOS?
- Name the framework that is used to construct application’s user interface for iOS?
- What is Category and class extension? How these differ?
- What is the purpose of reuseIdentifier? What is the benefit of setting it to a non-nil value?
- Differentiate ‘app ID’ from ‘bundle ID.’ Explain why they are used?
- What are the different types of iOS Application States: Not running, Inactive, Active, Background, Suspended.
- What major changes released in iOS7, iOS8, iOS9+?
- Does Objective C have function overloading?
- What is the difference between overloading and overriding?
- What is messaging? How does the runtime handle message passing? What is message forwarding?
- Does Objective C have multiple inheritances? Why not? How to imitate various inheritances?
- 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?
- How do you check if your code has memory leaks?
- Ideas of notification center, nearby and remote notifications?
- What is Dependency Management Tools : Cocoapods etc?
- Common reasons for app rejection from App store review process?
- What Persistent storage used in Mobile Apps - iOS?
- What is ORM?
- What is Core Data?
- How do you setup/initialise a core data stack in your application? Is this activity performed on main thread? If not, why?
- What is NSPersistentStoreCoordinator? What duties does it perform?
- What is NSPersistentStore? Is it thread safe?
- What is NSManagedObjectContext? What are the different concurrency types? Explain them.
- What is NSManagedObjectModel?
- What is NSManagedObject?
- Different types of persistent stores? Which all types can we have on iOS?
- Can my application have multiple models? (Yes)
- In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file? (Yes, Hint: configurations)
- What are the different store migration options? When are they used? How do they work? What is mapping model?
- Explain parent-child context setup. How does it work? What are the advantages?
- What is difference between performBlock: and performBlockAndWait:?
- Are the NSManagedObjectContext queues serial or concurrent?
- Can you pass same core data objects between different threads and modify?
- What performance issues can you face when using CoreData?
- What is NSFetchedResultsController? How do you turn on content monitoring?
- 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)
- What are the different delete rules that a relationship can have? Which one takes ownership?
- In NSFetchRequest can we fetch only a selective few attributes of an entity? How?
- Can I have relationship between entities in separate stores (in case of configurations)? (No)
- What are fetched properties? How do you create a fetched property?
- Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?
- When a NSFetchRequest fetches an entity object from store, does it fetch all of its data at once?
- What is a fault?
- What are transient properties?
- How core Data Works to save data in Persistent storage?
- What persistent storage Core data uses to save data?
- How Core Data differs from SQLite?
- Is Core Data is thread safe?
- How to use Core Data Objects between two threads?
- How to handle concurrency problems in Core Data?
- What is NSUserDefaults?
- What is plist?
Looking for a new job? Do not miss to read our iOS Interview Questions and answers. Whether you are a fresher or an experienced, these questions and answers that can help you to crack your interview.
There are CPU designs upheld by IOS gadgets:-
- 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.
- 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
- 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
We cannot support the same application for iPhone 3GS AND 5, 6, 7 because iPhone 3GS doesn’t support IOS6 or later versions.
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.
you can create .app, .ipa, .a and .framework.
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.
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.
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.
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.
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.
The app is running within the foreground and is receiving events. This is often the conventional mode for foreground apps.
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.
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.
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
There are some events of the UI view controller:-
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.)
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.
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.
The application has not been propelled or was running but instead was ended by the framework.
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.
The application is running in the foreground area and is accepting events. This is the ordinary mode for frontal area applications.
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.
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.
- 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.
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.
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.
[ivar release]; //Release any retained variables before super dealloc
[super dealloc]; //Only place in your code you should ever call dealloc
There are some ways to ascertain or observe memory leaks: -
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.
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.
- Broken Links:
- 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.
- 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.
- 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.
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:-
- Property List