Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:40:02+00:00 2026-06-12T08:40:02+00:00

I am maintaining an iOS app that currently uses Core Data to get data

  • 0

I am maintaining an iOS app that currently uses Core Data to get data off a db and populate a table view. A new requirement has come up that the entire database must be encrypted with SQLCypher and based on my research, Core Data refuses to play nice with the cypher. So it has been decided that coredata support be removed and database calls now must be made by hand. In this case, is there any library/project out there that emulates the functionality of the NSFetchedResults in CoreData that manages the db interaction and plays nice with TableViews?

I am looking for advice on architecting the project in a way to have the lowest amount of code littered with sql statements to do the db interaction. Can anyone please advice on how this can be accomplished?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:40:03+00:00Added an answer on June 12, 2026 at 8:40 am

    Maybe this solution can help you keep Core Data and provide encryption for the contents.

    Let’s say we have a Core Data object named MyObject with one attribute MyData. Then set the property transient for this attribute in the CoreData model. Now define a second attribute MySecretData with the attribute type Binary Data. This is where the actual data will be stored.

    Now create a category on the NSManagedObject subclass like this:

    @interface MyObject (Access)
    
    - (NSData*)myData;
    - (void)setMyData:(NSData*)value;
    
    @end
    
    @implementation MyObject (Access)
    
    - (NSData*)MyData {
        NSMutableData * tmpValue;
    
        [self willAccessValueForKey:@"MyData"];
        tmpValue = [self primitiveValueForKey:@"MyData"];
        [self didAccessValueForKey:@"MyData"];
    
        if(!tmpValue) {
            NSData *encryptedData = [self valueForKey:@"MySecretData"];
            if(encryptedData) {            
                tmpValue = [NSMutableData dataWithData:encryptedData];
                BOOL success = [tmpValue decryptWithKey:nil];
                if (!success) {
                    // Error Handling here
                }
                tmpValue = [tmpValue zlibInflate];
                [self setPrimitiveValue:tmpValue forKey:@"MyData"];
            }
            else {
                tmpValue = nil;
                [self setMyData:tmpValue];
            }
        }
        return tmpValue;
    }
    
    - (void)setMyData:(NSData *)data {
        NSData* tmpValue;
            [self willAccessValueForKey:@"MyData"];
            tmpValue = [self primitiveValueForKey:@"MyData"];
            [self didAccessValueForKey:@"MyData"];
    
            if([tmpValue isEqual:data])
            return;
    
            [self willChangeValueForKey:@"MyData"];
            [self setPrimitiveValue:data forKey:@"MyData"];
            [self didChangeValueForKey:@"MyData"];
            NSMutableData* encryptedData = nil;
            if (data != nil) {
                encryptedData = [NSMutableData dataWithData:data];
                encryptedData = [encryptedData zlibDeflate];
                BOOL success = [encryptedData encryptWithKey:nil];
                if (!success) {
                    // Error Handling here
                }
    
            }
            [self setPrimitiveValue:encryptedData forKey:@"MySecretData"];
    }
    
    @end
    

    In this case the data is encrypted and also deflated. From your code you can access MyData as usual. Inside the Core Database all values will be encrypted. Of course you have to use proper crypto functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am maintaining a web application that uses java.protocol.handler. I initialize it with a
I'm maintaining a script that can get its input from various sources, and works
I'm maintaining an app that was made for english speaking users. I was asked
I am maintaining a large project that uses a lot of WCF services and
I am maintaining an app that has been live on the AppStore for a
I am maintaining an app for a client that is used in two locations.
I'm maintaining some code that uses a *= operator in a query to a
I'm maintaining an old VB6 application, that uses some Sheridan 3D controls (SSPanel and
m maintaining a project, that has to be compatible through PHP 4.X to 5.2.
I'm currently maintaining an "old" system written in C# .NET, removing some obsolete features

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.