Your business is growing, and you know what your next step is: A mobile app. Building an application has never been so relevant as it is these days, and most businesses have one to gain and retain customers. You conduct a market research and find out that an iOS app is your best bet. Now, building an iOS application is not as easy as making a cup of coffee, you need a talented developer. Specifically, you need to hire an Object-C developer. How do you do that effectively? Once selected, make sure you ask the right questions in your interview. Ihor Shcherbinin, our Recruitment Director created a list with 8 interview questions to ask an Objective C developer.
Jump to:
- Objective-C Interview Questions
- 1. Explain Method Swizzling in Objective C and Why You Want to Use It
- 2. What are the Methods of Using NSURL Connection?
- 3. Explain KVC and KVO and Provide an Example of Using KVC to set a Value
- 4. Explain the Responder Chain
- 5. When Would You Use NSArray and NSMutableArray?
- 6. What Are Some of the Advantages and Disadvantages of Categories?
- 7. Can a Static Library Contain Images, Sound Files, etc?
- 8. What is a Protocol and How Do You Define It?
- Simply Hire a Remote Objective-C Developer with DistantJob
What is Object-C Development?
Objective-C is an object-oriented programming language that adds more versatile and flexible messaging to C. This language is predominantly used by Apple for its operating systems.
Although Apple recently created Swift, many people still look to hire an Objective-C developer instead for many reasons, such as its time-tested reliability. This language was first created in 1983 in an attempt to combine C’s low-level control with object-oriented features in order to allow more customizable system libraries and easier communication.
When Steve Jobs left Apple and founded NeXT Computer in 1985, this company chose to use Objective-C for development. When Jobs returned to Apple, he brought the OS created with NeXT, thus bringing with him Objective C.
Ever since companies who want to build Apple software search for Objective-C developers for hire. This language has been used to build over a million different applications, which means that it is well proven and tested.
The large amount of applications and developers who are experts in Objective-C also means that many companies won’t likely switch over to Swift, at least not quickly, so you can feel secure in hiring an Objective-C developer.
Additionally, Swift is still a relatively new language, only being a few years old, so there aren’t as many resources dedicated to helping learn and debug this language as compared to Objective-C.
Objective-C Interview Questions
Now that you know the importance of Objective-C development, you need to understand what to ask them to confirm they know the language inside and out. Here are the essentials interview questions you should ask. If you want to find a highly vetted and tested expert without the hassle of searching and interviewing them, reach out to the DistantJob experts in recruiting remote developers.
➡️ And if you are looking to interview a C# developer check out our blog post : Key C Sharp Interview Questions!
1. Explain Method Swizzling in Objective C and Why You Want to Use It
This feature lets your developers write code that can be executed before and/or after the original method. It functions by changing the implementation of an existing selector, possible only because method invocations in Objective-C are able to be changed at runtime.
The implementation is switched at runtime for a different implementation via method swizzling. Let’s take a look at an example:
#import “UIViewController+Log.h”
@implementation UIViewController (Log)
+ (void)load {
static dispatch_once_t once_token;
dispatch_once(&once_token, ^{
SEL viewWillAppearSelector = @selector(viewDidAppear:);
SEL viewWillAppearSelector = @selector(log_viewDidAppear:);
Method originalMethod =
class_getInstanceMethod(self, viewWillAppearSelector);
Method extendedMethod =
class_getInstanceMethod(self, viewWillAppearLoggerSelector);
method_exchangeImplementations(originalMethod, extendedMethod);
});
}
(void) log_viewDidAppear:(BOOL)animated {
[self log_viewDidAppear:animated];
NSLog(@”viewDidAppear executed for %@”, [self class]);
}
@end
2. What are the Methods of Using NSURL Connection?
The methods for NSURL connection are:
- A connection that receives the response
- A connection that receives data
- A connection that fails with an error
- A connection that did finish on loading
3. Explain KVC and KVO and Provide an Example of Using KVC to set a Value
Your Objective-C developer should know that KVC stands for Key-Value Coding and KVO represents Key-Value Observing.
KVC lets you access a property or value via a string. You can access these at runtime with the string, as opposed to needing to statically know the property names during development.
KVO, on the other hand, lets your developers see (or observe) any changes to a property or value. In order to observe a property with KVO, you need to identify the property with a string via KVC. Therefore, it’s important to recognize that the object isn’t observable with KVO unless it is KVC compliant.
Let’s look at an example with a property name on a class.
@property (nonatomic, copy) NSString *name;
We are able to access it with KVC:
NSString *n = [object valueForKey:@”name”]
We are able to modify the value by sending a message:
[object setValue:@”Mary” forKey:@”name”]
4. Explain the Responder Chain
The way the apps receive and handle events is by using responder objects. These objects are any instance of the UIResponder class; they receive raw event data and either handle the event or forward it on to another responder object. Any unhandled events pass from responder to responder in an active responder chain, or a “dynamic configuration of your app’s responder objects.”
Your Objective-C developer to hire should know that there is no single responder chain within your app, and all default rules can be changed. Apple has provided this figure to illustrate the default responder chain in an app whose interface has a label, a text field, a button, and two background views.
As you can see, if the text field doesn’t handle the event, it will be sent to the text field’s parent UIView object by UIKit, followed by the root view of the window. From here, the responder chain then diverts to the owning view controller before directing the event to the window.
Then, the event is delivered to the UIApplication object if the window doesn’t handle the event. It could potentially also go to the app delegate if the object is an instance of UIResponder and not already part of the responder chain.
5. When Would You Use NSArray and NSMutableArray?
NS Array should be used when data in the array doesn’t change. An example can be to put the company name in NS Array so that way no one can manipulate it. On the other hand, NS MutableArray is used when data in an array will change. If you’re passing an array to a function and that function will append some elements in that array then NS MutableArray is the best option.
6. What Are Some of the Advantages and Disadvantages of Categories?
The benefit of using categories is that you can extend any class, even those in which you don’t have the source. Categories also provide you with a nice way to structure code across compilation units using logical grouping. The main disadvantage is that you can’t safely override methods already defined by the class itself or another category.
7. Can a Static Library Contain Images, Sound Files, etc?
No, you can only provide code with a static library. This is because .a files are simple archives of object files, with the added ability under Mac/iOS of supporting CPU architectures. The only option is to create a Framework.
8. What is a Protocol and How Do You Define It?
A protocol is similar to Java’s interface. It defines a list of required and optional methods that a class must/can implement if it adopts the protocol. Any class can implement a protocol, and other classes can then send messages to that class based on the protocol methods without knowing the class type.
@protocol MyCustomDataSource
- (NSUInteger)numberOfRecords;
- (NSDictionary *)recordAtIndex:(NSUInteger)index;
@optional
- (NSString *)titleForRecordAtIndex:(NSUInteger)index;
@end
Let’s take a look at some of the main reasons you should hire an Objective-C developer.
Why Hire an Objective-C Developer
Large community
Every single developer who wanted to program for OS X or iOS with Apple used Objective-C. Even after the release of Swift, many still learn Objective-C or have chosen to stick with it rather than learn Swift.
This means that not only are there many books, classes, online courses, and resources dedicated specifically to Objective-C, but also that there’s an active online community on sites like StackOverflow.
So, if your developer gets stuck on a particularly tough bug or problem, they are almost guaranteed to have someone there to help them out. Additionally, because this code has been used by so many coders for so long, elegant solutions to common problems are already thoroughly explained online, meaning less development time for your employees.
More Flexibility
Objective-C is still C-compatible, but it features Object-Oriented extensions that allow you to send any messages to any object. This means that, unlike other C-based languages (e.g. C++ and C#), it isn’t statically typed and objects aren’t directly tied to their class.
In fact, when you are using Objective-C, developers can send messages to objects even if they’re unsupported. If the object is unsure how to handle the message, it can forward it.
Overall, in there is a lot of flexibility with message handling in this language.
Battle-tested
As explained, this language has been around for quite a while, with many different applications developed by every iOS and OS X developer, as it was the only option for many years.
It is also built of C, a language that was created in 1972 and has plenty of support and testing. Essentially, if you hire an Objective-C developer who is experienced, you know your applications will run beautifully.
Simply Hire a Remote Objective-C Developer with DistantJob
Now you understand the benefits of Objective-C and the best interview questions to ask your potential developer. If you want to skip the time-consuming job search, contact us to find a well-vetted and guaranteed expert developer to help you with your future plans.