SFPathUtil Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | SFPathUtil.h |
Overview
This is a utility class that helps to create sub folder under either Documents directory or cache directory. Any folder or file created by SFPathUtil will be marked with NSFileProtectionCompleteUntilFirstUserAuthentication attribute and also excluded from iCloud backup
+ createFileItemIfNotExist:skipBackup:
Creates the file at the specified path if it doesn’t exist
+ (void)createFileItemIfNotExist:(NSString *)path skipBackup:(BOOL)skipBackupParameters
path |
The path where the file should be created |
|---|---|
skipBackup |
YES if the file should be marked to not be backed up with iCloud |
Declared In
SFPathUtil.h
+ applicationDocumentDirectory
Returns application’s dcoument directory
+ (NSString *)applicationDocumentDirectoryDeclared In
SFPathUtil.h
+ applicationCacheDirectory
Returns application’s cache directory
+ (NSString *)applicationCacheDirectoryDeclared In
SFPathUtil.h
+ applicationLibraryDirectory
Returns the absolute path for libray folder
+ (NSString *)applicationLibraryDirectoryDeclared In
SFPathUtil.h
+ absolutePathForDocumentFolder:
Returns the absolute path for a directory/folder located in the apps document directory.
+ (NSString *)absolutePathForDocumentFolder:(NSString *)folderParameters
folder |
Folder to create under Document directory |
|---|
Discussion
It also ensures this sub-directory exists, applies NSFileProtectionCompleteUntilFirstUserAuthentication protection attributes and also mark file to be not backup by iCloud Folder created will be protected by NSFileProtectionCompleteUntilFirstUserAuthentication.
Declared In
SFPathUtil.h
+ absolutePathForCacheFolder:
Returns the absolute path for a directory/folder located in the apps document directory
+ (NSString *)absolutePathForCacheFolder:(NSString *)folderParameters
folder |
Folder to create under Cache directory |
|---|
Discussion
It also ensures this sub-directory exists, applies file protection attributes and also mark file to be not backup by iCloud Folder created will be protected by NSFileProtectionCompleteUntilFirstUserAuthentication
Declared In
SFPathUtil.h
+ absolutePathForLibraryFolder:
Returns the absolute path for libray folder
+ (NSString *)absolutePathForLibraryFolder:(NSString *)folderParameters
folder |
Folder to create under Library directory |
|---|
Discussion
It also ensures this sub-directory exists, applies file protection attributes and also mark file to be not backup by iCloud Folder created will be protected by NSFileProtectionCompleteUntilFirstUserAuthentication
Declared In
SFPathUtil.h
+ secureFilePath:markAsNotBackup:
Add iOS file protection to the specified file path and also mark DO NOT back up by iCloud if notbackupFlag is true The file or path that is passed in must already exist
+ (void)secureFilePath:(NSString *)filePath markAsNotBackup:(BOOL)notbackupFlagParameters
filePath |
Path to file or folder |
|---|---|
notbackupFlag |
Set to YES if need to mark as do not back up by iCloud |
Declared In
SFPathUtil.h
+ absolutePathForDocumentFolder:fileProtection:
Returns the absolute path for a directory/folder located in the apps document directory
+ (NSString *)absolutePathForDocumentFolder:(NSString *)folder fileProtection:(nullable NSString *)fileProtectionParameters
folder |
Folder to create under Document directory |
|---|---|
fileProtection |
File protection string. If nil, NSFileProtectionCompleteUntilFirstUserAuthentication will be used |
Discussion
It also ensures this sub-directory exists, applies NSFileProtectionCompleteUntilFirstUserAuthentication protection attributes and also mark file to be not backup by iCloud
Declared In
SFPathUtil.h
+ absolutePathForCacheFolder:fileProtection:
Returns the absolute path for a directory/folder located in the apps document directory
+ (NSString *)absolutePathForCacheFolder:(NSString *)folder fileProtection:(nullable NSString *)fileProtectionParameters
folder |
Folder to create under Cache directory |
|---|---|
fileProtection |
File protection string. If nil, NSFileProtectionCompleteUntilFirstUserAuthentication will be used |
Discussion
It also ensures this sub-directory exists, applies file protection attributes and also mark file to be not backup by iCloud
Declared In
SFPathUtil.h
+ absolutePathForLibraryFolder:fileProtection:
Returns the absolute path for library folder
+ (NSString *)absolutePathForLibraryFolder:(NSString *)folder fileProtection:(nullable NSString *)fileProtectionParameters
folder |
Folder to create under Library directory |
|---|---|
fileProtection |
File protection string. If nil, NSFileProtectionCompleteUntilFirstUserAuthentication will be used |
Discussion
It also ensures this sub-directory exists, applies file protection attributes and also mark file to be not backup by iCloud
Declared In
SFPathUtil.h
+ secureFilePath:markAsNotBackup:fileProtection:
Add iOS file protection to the specified file path and also mark DO NOT back up by iCloud if notbackupFlag is true The file or path that is passed in must already exist
+ (void)secureFilePath:(NSString *)filePath markAsNotBackup:(BOOL)notbackupFlag fileProtection:(nullable NSString *)fileProtectionParameters
filePath |
Path to file or folder |
|---|---|
notbackupFlag |
Set to YES if need to mark as do not back up by iCloud |
fileProtection |
File protection string. If nil, NSFileProtectionCompleteUntilFirstUserAuthentication will be used |
Declared In
SFPathUtil.h
+ secureFileAtPath:recursive:fileProtection:
Add DO NOT back up flag to the file resource specified by the file path
+ (void)secureFileAtPath:(NSString *)filePath recursive:(BOOL)recursive fileProtection:(nullable NSString *)fileProtectionParameters
filePath |
file path |
|---|---|
recursive |
If filePath points to a directlory, set to YES to recursively apply skip backup attribute to all files under the directory including sub-directory under the directory |
fileProtection |
File protection string. If nil, NSFileProtectionCompleteUntilFirstUserAuthentication will be used |
Declared In
SFPathUtil.h