Search Your Question

What is Core Data Stacks?

Ans : Core Data is Apple’s object graph management and persistency framework.

Core Data Stack
Core Data Stack


  1. Managed Object
  2. Managed Object Context
  3. Managed Object Model
  4. Persistent Store Coordinator

  1. NSManagedObject’s are the model objects exposed by Core Data.
  2. NSManagedObjectModel is a database schema that describes the application’s entities. It defines the structure of the managed objects.
  3. NSPersistentStoreCoordinator associates persistent storage and managed object model. It lends itself to mapping the data from the storage, say SQLite data base rows, into the object model. It is a task of high complexity and is often taken for granted when working with Core Data.What is more, the persistent coordinator is used by the managed object context when it comes to saving or fetching objects.
  4. NSManagedObjectContext controls the life cycle of the managed objects and provides operations to create, save and fetch them. You can think of the managed object context as a scratch pad with a group of managed objects.

Starting from iOS 10, NSPersistentContainer is responsible for creation and management of the Core Data stack.
NSPersistentContainer exposes a managed object model, a managed object context and a persistent store coordinator as well as provides many convenience methods when working them, especially when it comes to multithreaded applications.



What is delete rule in Core Data?

Ans : In our database, there may be multiple entities. One entity is connected with another entity in relationship. So deleting one data from one entity may have impact on another entity data depends on relationship or delete rule.

There are 4 delete rules :

  1. No Action
  2. Nullify
  3. Cascade
  4. Deny
Let's take example having one department entity and it is connected to employee entity with relationship as one-to-many. Employee to department entity relationship is one-to-one.

1. No Action : When No Action delete rule is set to relationship, then there will be no impact of deleting record from one entity. If we delete record from department connected to multiple employees, then there be no impact on employee entity. Employee assume that it has still relation with deleted department.

2. Nullify : If delete rule is set to Nullify to the relationship then the destination of the relationship gets nullify.  In our case, if department is deleted, then relationship between employee and department gets nullify. This is default delete rule.

3. Cascade Rule : If we delete department, then its related employees will be deleted if this delete rule is set. This rue is only used when data model has more dependency. 

4. Deny Delete Rule : This is opposite of Cascade Rule. If we set this rule, and we try to delete department which is connected to any of employee, then we are not allowed to delete department.

Depends on project requirement, we can set delete rule.


What is lazy loading?

Ans :  Lazy Loading Images is a technique to resolve loading image from the web. The thing is that, I need to display images directly from the web in UIImageView or any other control. 

For this, if you simply try to set the image using in-built setImage method then your application gets stuck while loading image from the web. To overcome this issue, there is a technique generally known as Lazy Loading Image. The thing actually happening in lazy loading is that the task of image loading from web is performed in background and at that time a temporary placeholder image is displayed in the control. When the actual image is fully loaded from the web, it is replaced with the placeholder image and you get your actual image on the control without having stuck interface.

You can use third party library to load image :  SDWebImage

Try to make own coding for loading image from URL and Save in cache and display in imageView.



What is apple enterprise account?

Ans : 

To Develop and Distribute app, there are two types of licence available.

1. Apple Developer
2. Apple Developer Enterprise

Difference : 



Source : LeoLearning



Can I store null value in info.plist?

Ans : 

Null or NSNull value type is not supported in info.plist file. Base type of info.plist file is array or dictionary. In array or dictionary, you can save only following type :


  1. Array
  2. Dictionary
  3. Boolean
  4. Data
  5. Date
  6. Number
  7. String
No above type supports nil value. They are not optional. So null or nil value can not be stored in info.plist file.