Câu hỏi phỏng vấn iOS
Câu hỏi

What is CoreData?

Câu trả lời

Core Data is a powerful framework provided by Apple for managing the model layer objects in iOS and macOS applications. It serves as an object graph and persistence framework, allowing developers to efficiently store, retrieve, and manage data within their apps.

Key Features of Core Data

  1. Object Graph Management:

    • Core Data allows developers to work with data in an object-oriented manner. It abstracts the underlying data storage, enabling developers to interact with data as objects rather than dealing directly with SQL or other database languages[8][10].
  2. Persistence:

    • Core Data provides robust data persistence capabilities. It can store data in various formats, including SQLite, XML, and binary. This ensures that data is saved and can be retrieved even after the app is closed and reopened[8][10].
  3. Data Model:

    • Developers define the structure of their data using a data model file (.xcdatamodeld). This file includes entities (analogous to tables in a database), attributes (analogous to columns), and relationships between entities[8][10][16].
  4. Managed Object Context:

    • Core Data uses a managed object context to track changes to objects. This context acts as a workspace where objects are created, fetched, updated, and deleted. Changes in the context can be saved to the persistent store[8][10][14].
  5. Core Data Stack:

    • The Core Data stack is a set of classes that work together to manage the data model. It includes the managed object model, persistent store coordinator, and managed object context[14][16].
  6. Querying and Filtering:

    • Core Data provides powerful querying capabilities using NSFetchRequest and NSPredicate. These tools allow developers to fetch and filter data efficiently[8][10][14].
  7. Schema Migration:

    • Core Data supports schema migration, which allows developers to modify the data model over time without losing existing data. This includes lightweight migrations for simple changes and more complex staged migrations for significant changes[8][13].
  8. Undo and Redo:

    • Core Data includes built-in support for undo and redo operations, making it easier to manage changes to data and revert to previous states if necessary[...
junior

junior

Gợi ý câu hỏi phỏng vấn

middle

What is the Responder Chain?

junior

What is the difference between viewDidLoad and viewDidAppear ?

senior

What are the most important application delegate methods?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào