iOS Interview Questions
Best iOS Interview Questions And Answers
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