다음을 통해 공유


MSMutableProtectedData protectedDataWithPolicy:path:completionBlock method

Asynchronously creates and returns an empty MSMutableProtectedData object that can be used to write and protect data to the specified file. The file will be protected using the specified policy and saved in Microsoft Protected File format.

Signature

+ (void)protectedDataWithPolicy:(MSUserPolicy *)userPolicy
          originalFileExtension:(NSString *)originalFileExtension
                           path:(NSString *)path
                completionBlock:(void(^)(MSMutableProtectedData *data, NSError *error))completionBlock;

Parameters

Name Datatype Notes
protectionPolicy
[MSUserPolicy](msuserpolicy-interface-objc.md) *
Required.
originalFileExtension
NSString *
Used to store the original file type, before protection.
path
NSString *
Required. The absolute path to the new protected file.
completionBlock
void(^)([MSMutableProtectedData](msmutableprotecteddata-interface-objc.md) *data, NSError *error)
Required. Called with the following parameters when the method is completed:
data - The protected file object.
error - If there is an error creating the data object, contains an NSError object that describes the problem.
[!Note]
If the user cancels the operation, both the data and error parameters will be NIL.

Defined in

MSMutableProtectedData.h

Supported Platforms

Minimum supported OS versions
iOS 7.0 and OS X 10.8

See also

MSMutableProtectedData