Answer:
Objective-c is reference counted, so objects are deleted when the reference count reaches 0. release reduces the reference-count immediately, autorelease reduces it when the autorelease-pool is popped.
Top Interview Questions And Answers in Objective C
Most Important iPhone interview Questions and Answers
3. Difference between protocol in objective c and interfaces in java?
Answer:
delegate protocol needs to be defined as such
@protocol
//methods
@end
It can be put in any .h class, you just need to import i t whenever you are going to use it.
A protocol is not like a java interface, a protocol is an adapter that allows two classes to works together.
Basically it says, if you want class A to send you messages about its state and actions these are the methods it will call on its delegate that you must implement.
It's not like an interface because an interface says if you want to subclass this class you must implement these methods, the protocol says if you want to interact with this class you must implement these methods, so it's somewhat different.
Read:
What is the difference between IBOutlet and IBAction in iOS ?
Some important points About View Controller.
4.What is push notification?
Answer:-
In iOS, apps can’t do a lot in the background. Apps are only allowed to do limited set of activities so battery life is conserved.
But what if something interesting happens and you wish to let the user know about this, even if they’re not currently using your app?
For example, maybe the user received a new tweet, their favorite team won the game, or their dinner is ready. Since the app isn’t currently running, it cannot check for these events.
Luckily, Apple has provided a solution to this. Instead of your app continuously checking for events or doing work in the background, you can write a server-side component to do this instead.
And when an event of interest occurs, the server-side component can send the app a push notification! There are three things a push notification can do:
- Display a short text message
- Play a brief sound
- Set a number in a badge on the app’s icon
Read:-
Why properties are made nonatomic in Objective C?
What are the differences between Cocoa and Cocoa Touch?
5. How can we achieve singleton pattern in iOS?
Answer:-
The Singleton design pattern ensures a class only has one instance, and provides a global point of access to it.
The class keeps track of its sole instance and ensures that no other instance can be created.
Singleton classes are appropriate for situations where it makes sense for a single object to provide access to a global resource.
A singleton class returns the same instance no matter how many times an application requests it.
Read:
Top iOS Interview Questions And Answers for Beginners
How to Integrate Google Signin SDK in iOS Application using Swift
How To Add A SWIFT Bridging Header in iOS
Top Swift interview Questions And Answers for Freshers