swift – How to test/verify file protection security with complete file protection option in iOS?


I have implemented the file protection security in iOS app but not able to verify/test it. How can test applied protection in saved files in document directory.

I have added data protection capability in app target

I have enabled iTunes file sharing in app for showing files in finder

            let fileManager = FileManager.default
        do {
            let documentDirectory = try fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false)
            let fileURL = documentDirectory.appendingPathComponent("testFile3")
            try data?.write(to: fileURL, options: .completeFileProtection)
        } catch {
            print(error)
        }

enter image description here

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img