Search Your Question

Showing posts with label Infrasoft. Show all posts
Showing posts with label Infrasoft. Show all posts

How you can add column in entity in core data that can be also added in next release?

Ans : When you initialise a Core Data stack, one of the steps involved is adding a store to the persistent store coordinator. When you encounter this step, Core Data does a few things prior to adding the store to the coordinator. First, Core Data analyzes the store’s model version. Next, it compares this version to the coordinator’s configured data model. If the store’s model version and the coordinator’s model version don’t match, Core Data will perform a migration, when enabled.

Note: If migrations aren’t enabled, and the store is incompatible with the model, Core Data will simply not attach the store to the coordinator and specify an error with an appropriate reason code.

Migrations happen in three steps:
  1. Core Data copies over all the objects from one data store to the next. 
  2. Core Data connects and relates all the objects according to the relationship mapping. 
  3. Enforce any data validations in the destination model. Core Data disables destination model validations during the data copy.
Database Migration : 

Lightweight Migration
Manual Migration
Custom Manual Migration
Fully Manual Migration

Setting for Lightweight Migration: 

NSMigratePersistentStoresAutomaticallyOption: true
NSInferMappingModelAutomaticallyOption: true


Coredata Migration Tutorial : RayWanderLich


What is entry point of iOS Application?

Ans : 

In mostly language, There is having main method in main file which is starting point of project. In iOS, also same approach are there.

Objective-C :

main.m File :

int main(int argc, char * argv[]) {
        NSString * appDelegateClassName;
        @autoreleasepool {
            // Setup code that might create autoreleased objects goes here.
            appDelegateClassName = NSStringFromClass([AppDelegate class]);
        }
        return UIApplicationMain(argc, argv, nil, appDelegateClassName);
        
        

    }

Swift : 

AppDelegate.swift

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {




In Swift, @UIApplicationMain attribute is a replacement of main.m file & and entry point for your application to start.