UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Access Control with CoreData and FileManager

Forums > Swift

Hi everybody, How are you today?

I’m building an app that allows people to play sounds. Some sounds are premium and some aren’t.

I get the sounds from a database and then save them to CoreData so they won’t need to get fetched every time a user opens the app, but only when there’s an update in the database.

Here are my problems:

Each sound has a flag “isPremium” and if a sound is a premium sound, it allows only premium users to play it. If I save the sounds to core data then a user can alter that flag and effectively make all sounds, not premium. right? How can I prevent this?

Another problem is the audio file itself. I save the audio file of each sound to the device using FileManager, which means a user can get the audio file if they wanted to. From what I understand there is a way to restrict user access to certain directories: https://apple.co/2XrhvuJ But is it enough?

I’m completely open to suggestions. Thanks! 😊

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.