*Friday CLOSED

Timings 10.00 am - 08.00 pm

Call : 021-3455-6664, 0312-216-9325 DHA 021-35344-600, 03333808376, ISB 03333808376

Mobile App iOS Interview Questions and Answers Karachi Pakistan Dubai

Mobile App iOS Interview Q&A

Top iOS Interview Questions and Answers

Here are the top 19 sample iOS interview questions and their answers. These sample questions are framed by experts from Omni Academy who train for the iOS Training Course to give you an idea of the type of questions that are asked in interviews. We have taken full care to give the top answers to all the questions. Do comment your thoughts. Happy job hunting!

Top Answers to iOS Interview Questions

1. What are the characteristics of iOS?

CriteriaResult
Type of operating systemApple proprietary based on Macintosh OS X
OS fragmentationTightly integrated with Apple devices
SecurityHeightened security guaranteed

2. Which JSON framework is supported by iOS (iPhone OS)?

  • SBJson framework is supported by iOS. It is a JSON parser and generator for Objective-C (Objective-C is the primary programming language we use when writing software for OS X and iOS. It is a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime).
  • SBJson provides flexible APIs and additional control that makes JSON handling easy.

3. How can you prevent iOS 8 app’s streaming video media from being captured by QuickTime Player on Yosemite during screen recording?

HTTP live streams that have their media encrypted will not be recorded by QuickTime Player on Yosemite while screen recording. These will blackout in the recording.
HTTP live streaming: It sends live and on‐demand audio and video to iPhone, iPad, Mac, Apple TV, and PC with HTTP live streaming (HLS) technology from Apple. Using the same protocol that powers the web, HLS lets us deploy the content using ordinary web servers and content delivery networks. HLS is designed for reliability and dynamically adapts to network conditions by optimizing playback for the available speed of wired and wireless connections.

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

  • The UIKit framework is used to develop the application’s user interface. The UIKit framework provides event handling, drawing model, windows, views, and controls, specifically designed for a touch-screen interface.
  • The UIKit framework (UIKit.framework) provides the crucial infrastructure needed to construct and manage iOS apps. This framework provides:
    • Window and view architecture to manage an app’s user interface
    • Event handling infrastructure to respond to the user input
    • An app model to drive the main run loop and interact with the system

In addition to the core app behaviors, UIKit provides support for the following features:

  • A view controller model to encapsulate the contents of the user interface
  • Support for handling touch and motion-based events
  • Support for a document model that includes iCloud integration
  • Graphics and windowing support, including support for external displays
  • Support for managing the app’s foreground and background execution
  • Printing support
  • Support for customizing the appearance of standard UIKit controls
  • Support for text and web content
  • Cut, copy, and paste support
  • Support for animating user-interface content
  • Integration with other apps on the system through URL schemes and framework interfaces
  • Accessibility support for disabled users
  • Support for the Apple Push Notification service
  • Local notification scheduling and delivery
  • PDF creation
  • Support for using custom input views that behave like the system keyboard
  • Support for creating custom text views that interact with the system keyboard
  • Support for sharing content through Email, Twitter, Facebook, and other services

5. How can you respond to state transitions on your app?

State transitions can be responded to state changes in an appropriate way by calling corresponding methods on the app’s delegate object.

For example:

  • applicationDidBecomeActive( ) method: To prepare to run as the foreground app
  • applicationDidEnterBackground( ) method: To execute some code when the app is running in the background that may be suspended at any time
  • applicationWillEnterForeground( ) method: To execute some code when the app is moving out of the background
  • applicationWillTerminate( ) method: Called when the app is being terminated

6. What are the features added in iOS 9?

The following features are added in iOS 9:

  • Intelligent search: It is an excellent mechanism to learn user habits and act on that information—open apps before we need them, make recommendations on places we might like, and guide us through our daily lives to make sure we’re where we need to be at the right time.
  • Siri: It is a personal assistant to the users that is able to create contextual reminders and search through photos and videos in new ways. Swiping right from the home screen brings up a new screen that houses ‘Siri Suggestions,’ putting favorite contacts and apps right on our fingertips, along with nearby restaurant and location information and important news.
  • Deeper search capabilities: It can show results such as sports scores, videos, and content from third-party apps, and we can even do simple conversions and calculations using the search tools on our iPhone or iPad.
  • Performance improvements: The following built-in apps have been improved:
    • Notes including new checklists and sketching features
    • Maps now offering transit directions
    • Mail allowing for file attachments
    • New ‘News’ app that learns our interests and delivers relevant content we might like to read
    • Apple Pay being improved with the addition of store credit cards and loyalty cards
    • ‘Passbook’ being renamed to ‘Wallet’ in iOS 9
  • San Francisco font
  • Wireless CarPlay support
  • Optional iCloud Drive app: It is a built-in two-factor authentication system with optional longer passwords for better security.

7. What is the difference between retain and assign?

Assign creates a reference from one object to another without increasing the source’s retain count.

if (_variable != object)
{   	
 [_variable release];  
  _variable = nil;  
  _variable = object;
 }

Retain creates a reference from one object to another and increases the retain count of the source object.

if (_variable != object)
{
  [_variable release];
    _variable = nil;  
_variable = [object retain];  
}

8. What are the different ways to specify the layout of elements in UIView?

Here are a few common ways to specify the layout of elements in UIView:

  • Using InterfaceBuilder, we can add an XIB file to our project, layout elements within it, and then load XIB in our application code (either automatically, based on naming conventions, or manually). Also, using InterfaceBuilder, we can create a storyboard for our application.
  • We can write our own code to use NSLayoutConstraints and have elements in a view arranged by Auto Layout.
  • We can create CGRects describing the exact coordinates for each element and pass them to UIView’s (id)initWithFrame:(CGRect)frame method.

9. What is the difference between atomic- and non-atomic properties? Which is default for synthesized properties? When would you use one over the other?

Properties specified as atomic are guaranteed to always return a fully initialized object. This also happens to be the default state for synthesized properties. While it is a good practice to specify atomic properties to remove the potential for confusion, if we leave it off, the properties will still be atomic.

This guarantee of atomic properties comes at the cost of performance. However, if we have a property for which we know that retrieving an uninitialized value is not a risk (e.g., if all access to the property is already synchronized via other means), then setting it to non-atomic can boost the performance.

10. Describe managed object context and its function.

A managed object context (represented by an instance of NSManagedObjectContext) is a temporary ‘scratchpad’ in an application for a (presumably) related collection of objects. These objects collectively represent an internally consistent view of one or more persistent stores.

A single-managed object instance exists in one and only one context, but multiple copies of an object can exist in different contexts.

The key functions of the managed object context include the following:

  • Life-cycle management: Here, the context provides validation, inverse relationship handling, and undo/redo.
  • Notifications: It refers to context posts’ notifications at various points that can be optionally monitored elsewhere in our application.
  • Concurrency: Here, the Core Data uses thread (or serialized queue) confinement to protect managed objects and managed object contexts.

11. Explain a singleton class.

When only one instance of a class is created in the application, that class is called a singleton class. See below:

@interface SomeManager : NSObject
             + (id)singleton;
 @end
 @implementation SomeManager
            + (id)singleton {    
                                 static id sharedMyManager = nil; 
                                 @synchronized([MyObject class]){ 
                                                     if (sharedMyManager == nil) { 
                                                                         sharedMyManager = [[self alloc] init]; 
                                                      } 
                                 }
                                return sharedMyManager;
            }
 @end
//using block
+ (id) singleton {
    static SomeManager *sharedMyManager = nil;
    static dispatch_once_t  onceToken;
dispatch_once(&onceToken, ^{
        sharedMyManager = [[self alloc] init];
    });
    return sharedMyManager;
}

12. What is an unnamed category?

An unnamed category has fallen out of favor now that @protocol has been extended to support the @optional methods.

Class Extensions

@interface Foo() is designed to allow us to declare additional private API— system programming interface (SPI)—that is used to implement the class innards. This typically appears at the top of the .m file. Any methods/properties declared in the class extension must be implemented in the @implementation, just like the methods/properties found in the public @interface.

Class extensions can also be used to re-declare a publicly read-only @property as read-write prior to doing @synthesize on the accessors.

Example:

Foo.h
@interface Foo:NSObject
@property(readonly, copy) NSString *bar;
-(void) publicSaucing;
@end
Foo.m
@interface Foo()
@property(readwrite, copy) NSString *bar;
- (void) superSecretInternalSaucing;
@end
@implementation Foo
@synthesize bar;
.... must implement the two methods or compiler will warn ....
@end

13. Does Objective-C contain private methods?

No, there is nothing called a private method in Object-C programming. If a method is defined in .m only, then it becomes protected; if it is defined in .h, it is public.

If we really want a private method, then we need to add a local category/unnamed category/class extension in the class and add the method in the category and define it in class.m.

14. What is a plist?

Property list or plist refers to a list that organizes data into named values and lists of values using several object types. These types provide us the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. Property lists are frequently used by applications running on both Mac OS X and iOS. The property-list programming interfaces for Cocoa and Core Foundation allow us to convert hierarchically structured combinations of these basic types of objects to and from standard XML. We can save the XML data to the disk and later use it to reconstruct the original objects.

The user defaults system, which we programmatically access through the NSUserDefaults class, uses property lists to store objects representing user preferences. This limitation would seem to exclude many kinds of objects, such as NSColor and NSFont objects, from the user defaults system. However, if objects conform to the NSCoding protocol, they can be archived to NSData objects, which are property-list-compatible objects.

15. What is the purpose of reuseIdentifier? What is the benefit of setting it into a non-nil value?

The reuseIdentifier is used to group together the similar rows in a UITableView, i.e., the rows that differ only in their content, otherwise having similar layouts. A UITableView will normally allocate just enough UITableViewCell objects to display the content visible in the table.

If reuseIdentifier is set to a non-nil value, then the UITableView will first attempt to reuse an already allocated UITableViewCell with the same reuseIdentifier when the table view is scrolled. If reuseIdentifier has not been set, then the UITableView will be forced to allocate new UITableViewCell objects for each new item that scrolls into view, potentially leading to laggy animations.

16. What is the difference between an ‘App ID’ and a ‘Bundle ID’? What is each used for?

  • An App ID is a two-part string used to identify one or more apps from a single development team. The string consists of a Team ID and a Bundle ID search strings, with a period (.) separating the two.
  • The Team ID is supplied by Apple and is unique to a specific development team, while a Bundle ID is supplied by the developer to match either the Bundle ID of a single app or a set of Bundle IDs of a group of apps.

Since most users consider the App ID as a string, they think it is interchangeable with the Bundle ID. Once the App ID is created in the Member Center, we can only use the App ID prefix that matches the Bundle ID of the application bundle.

The Bundle ID uniquely defines each app. It is specified in Xcode. A single Xcode project can have multiple targets and, therefore, outputs multiple apps. A common use case: an app having both lite/free and pro/full versions or branded multiple ways.

17. What is an abstract class in Cocoa?

Cocoa doesn’t provide anything called abstract. It can create a class abstract that gets checked only at the runtime while it is not checked at the compile time.

@interface AbstractClass : NSObject
@end
@implementation AbstractClass
+ (id)alloc{
    if (self == [AbstractClass class]) {
        NSLog(@"Abstract Class can’t be used");
    }
    return [super alloc];
@end

18. What is NSURLConnection class? Define its types and use cases.

There are two ways of using the NSURLConnection class. One is asynchronous and the other is synchronous.

An asynchronous connection will create a new thread and perform its download process on the new thread. A synchronous connection will block the calling thread while downloading the content and doing its communication.

Many developers think that a synchronous connection blocks only the main thread, which is not true. A synchronous connection will always block the thread from which it is fired. If we fire a synchronous connection from the main thread, the main thread will be blocked. However, if we fire a synchronous connection from a thread other than the main thread, it will be like an asynchronous connection and won’t block our main thread.

In fact, the only difference between synchronous and asynchronous connections is that at the runtime a thread will be created for the asynchronous connection while it won’t do the same for a synchronous connection.

In order to create an asynchronous connection, we need to:

  1. Have our URL in an instance of NSString
  2. Convert our string to an instance of NSURL
  3. Place our URL in a URL Request of type NSURLRequest or, in the case of mutable URLs, in an instance of NSMutableURLRequest
  4. Create an instance of NSURLConnection and pass the URL request to it

19. What is the relation between iVar and @property?

iVar is an instance variable. It cannot be accessed unless we create accessors, which are generated by @property. iVar and its counterpart @property can be of different names.

@interface Box : NSObject{
    NSString *boxName;
}
@property (strong) NSString *boxDescription;//this will become another ivar
-(void)aMethod;
@end
@implementation Box
@synthesize boxDescription=boxName;//now boxDescription is accessor for name
-(void)aMethod {
    NSLog(@"name=%@", boxName);
     NSLog(@"boxDescription=%@",self.boxDescription);
    NSLog(@"boxDescription=%@",boxDescription); //throw an error
}
@end

Related Courses

AWS Developer Training Course

Microsoft Azure Administrator – Associate

Certified Ethical Hacking (CEH) Course 

Microsoft SharePoint Admin
Microsoft SharePoint Developer

Salesforce Certified Platform Admin
Salesforce Certified Platform Developer

sharing is caring
Print Friendly, PDF & Email

Leave a Reply


ABOUT US

OMNI ACADEMY & CONSULTING is one of the most prestigious Training & Consulting firm, founded in 2010, under MHSG Consulting Group aim to help our customers in transforming their people and business - be more engage with customers through digital transformation. Helping People to Get Valuable Skills and Get Jobs.

Read More

Contact Us

Get your self enrolled for unlimited learning 1000+ Courses, Corporate Group Training, Instructor led Class-Room and ONLINE learning options. Join Now!
  • Head Office: A-2/3 Westland Trade Centre, Shahra-e-Faisal PECHS Karachi 75350 Pakistan Call 0213-455-6664 WhatsApp 0334-318-2845, 0336-7222-191, +92 312 2169325
  • Gulshan Branch: A-242, Sardar Ali Sabri Rd. Block-2, Gulshan-e-Iqbal, Karachi-75300, Call/WhatsApp 0213-498-6664, 0331-3929-217, 0334-1757-521, 0312-2169325
  • ONLINE INQUIRY: Call/WhatsApp +92 312 2169325, 0334-318-2845, Lahore 0333-3808376, Islamabad 0331-3929217, Saudi Arabia 050 2283468
  • DHA Branch: 14-C, Saher Commercial Area, Phase VII, Defence Housing Authority, Karachi-75500 Pakistan. 0213-5344600, 0337-7222-191, 0333-3808-376
  • info@omni-academy.com
  • FREE Support | WhatsApp/Chat/Call : +92 312 2169325
WORKING HOURS

  • Monday10.00am - 7.00pm
  • Tuesday10.00am - 7.00pm
  • Wednesday10.00am - 7.00pm
  • Thursday10.00am - 7.00pm
  • FridayClosed
  • Saturday10.00am - 7.00pm
  • Sunday10.00am - 7.00pm
Select your currency
PKR Pakistani rupee
WhatsApp Us