File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
FastImageCache/FastImageCache/FastImageCache Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -519,10 +519,16 @@ - (BOOL)canAccessEntryData {
519519 if ([_fileDataProtectionMode isEqualToString: NSFileProtectionCompleteUntilFirstUserAuthentication ] && _canAccessData)
520520 return YES ;
521521
522+ // -[UIApplication isProtectedDataAvailable] checks whether the keybag is locked or not
522523 UIApplication *application = [UIApplication performSelector: @selector (sharedApplication )];
523524 if (application) {
524525 _canAccessData = [application isProtectedDataAvailable ];
525- } else {
526+ }
527+
528+ // We have to fallback to a direct check on the file if either:
529+ // - The application doesn't exist (happens in some extensions)
530+ // - The keybag is locked, but the file might still be accessible because the mode is "until first user authentication"
531+ if (!application || (!_canAccessData && [_fileDataProtectionMode isEqualToString: NSFileProtectionCompleteUntilFirstUserAuthentication ])) {
526532 int fd;
527533 _canAccessData = ((fd = open ([_filePath fileSystemRepresentation ], O_RDONLY)) != -1 );
528534 if (_canAccessData)
You can’t perform that action at this time.
0 commit comments