Top IOS Interview Questions And Answers
Top Answers to IOS Interview Questions
Criteria | Result |
Type of Operating System | Apple Proprietary based on Macintosh OS X |
OS Fragmentation | Tightly integrated with Apple devices |
Security | Heightened security guaranteed |
• SBJson framework is supported by iOS. It is a JSON parser and generator for Objective-C (Objective-C is the primary programming language you use when writing software for OS X and iOS. It’s 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.
HTTP Live Streams that have their media encrypted will not be recorded by QuickTime Player on Yosemite while screen recording. These will black out out in the recording.
• HTTP Live Streaming: – Send 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 you deploy 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.
• The UIKit framework is used to develop application’s user interface. 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 user input, and
-> 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 your 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
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.
• Intelligent Search and Siri- Intelligent Search 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 is a personal assistant to the users, able to create contextual reminders and search through photos and videos in new ways. Swiping right from the home screen also brings up a new screen that houses “Siri Suggestions,” putting favorite contacts and apps right on your fingertips, along with nearby restaurant and location information and important news.
• Deeper search capabilities can show results like sports scores, videos, and content from third-party apps, and you can even do simple conversions and calculations using the search tools on your iPhone or iPad.Performance improvements
• Many of the built-in apps have been improved.
✓ Notes includes new checklists and sketching features
✓ Maps now offers transit directions
✓ Mail allows for file attachments, and
✓ New “News” app that learns your interests and delivers relevant content you might like to read.
✓ Apple Pay is being improved with the addition of store credit cards and loyalty cards
✓ Leading “Passbook” to be renamed to “Wallet” in iOS 9.
• San Francisco font, wireless CarPlay support
• An optional iCloud Drive app, built-in two factor authentication and optional longer passwords for better security.
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]; }
• Using InterfaceBuilder, you can add a XIB file to your project, layout elements within it, and then load the XIB in your application code (either automatically, based on naming conventions, or manually). Also, using InterfaceBuilder you can create a storyboard for your application.
• You can write your own code to use NSLayoutConstraints and have elements in a view arranged by Auto Layout.
• You can create CGRects describing the exact coordinates for each element and pass them to UIView’s – (id)initWithFrame:(CGRect)frame method.
• While it’s a good practice to specify atomic to remove the potential for confusion, if you leave it off, your properties will still be atomic.
• This guarantee of atomic properties comes at the cost to performance.
• However, if you have a property for which you know that retrieving an uninitialized value is not a risk (e.g. if all access to the property is already synchronized via other means), setting it to non-atomic can boost performance.
• 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 managed object context include
• Life-cycle management: Here, the context provides validation, inverse relationship handling and undo/redo
• Notifications refer to context posts notifications at various points that can be optionally monitored elsewhere in your application.
• Concurrency is when the Core Data uses thread (or serialized queue) confinement to protect managed objects and managed object contexts.
Only one instance of that class is created in the application.
@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; }
A class extension –
@interface Foo() — is designed to allow you to declare additional private API — SPI or System Programming Interface — 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 readonly @property as readwrite prior to @synthesize’ing 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
If you really want a private method then you need to add a local category/ unnamed category/ class extension in the class and add the method in the category and define it in the class.m
The user defaults system, which you 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 like as NSColor and NSFont objects, from the user default system. But if objects conform to the NSCoding protocol they can be archived to NSData objects, which are property list–compatible objects
• 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 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, the UITableView will be forced to allocate new UITableViewCell objects for each new item that scrolls into view, potentially leading to laggy animations.
• The Team ID is supplied by Apple and is unique to a specific development team while a bundle ID search string is supplied by the developer to match either the bundle ID of a single app or a set of bundle IDs for a group of apps.
Since most users consider the App ID as string, they think it is interchangeable with Bundle ID. Once the App ID is created in the Member Center, you 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, output multiple apps. A common use case for this – An app having both lite/free and pro/full versions or branded multiple ways.
Cocoa doesn’t provide anything called abstract. We can create a class abstract that gets checked only at runtime while it is not checked at 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
An asynchronous connection will create a new thread and performs its download process on the new thread. A synchronous connection will block the calling thread while downloading content and doing its communication.
Many developers think that a synchronous connection blocks the main thread, which is not true. A synchronous connection will always block the thread from which it is fired. If you fire a synchronous connection from the main thread, the main thread will be blocked. But, if you fire a synchronous connection from a thread other than the main thread, it will be like an asynchronous connection and won’t block your main thread.
In fact, the only difference between a synchronous and an asynchronous connection is that at 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 do the following:
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.
iVar is an instance variables. 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
Recent Comments