简体   繁体   中英

Can background services keep running when the App Data is encrypted in iOS

I am trying to research on creating an iOS application which has background services running in the background. The application data needs to be accessed for this background service.

Also I want the app data stored on the device to be encrypted. But it says in the description at the Apple Developer page that if app data is encrypted it can only be accessed when the phone is unlocked by the user.

Does this mean that if a background service requires app data in any way it will not be allowed to access it?

The access available in the background depends on the protection level that is assigned to the data. By default NSFileProtectionCompleteUntilFirstUserAuthentication is applied to data created by your app. This protection class will not allow access to the data until after the device has been unlocked by the user for the first time after a reboot. Once the device has been unlocked for the first time, then access is available until the device is next rebooted.

If you need your app to be able to access the data before the first unlock after a reboot you can apply NSFileProtectionNone . Note that even if this level is applied, all data on an iOS device is encrypted, but in this case the keys required to decrypt the data are stored on the device and do not require the user's passcode to generate a decryption key.

More information is available in Apple's iOS Security Guide and in the NSFileManager documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM