Created
February 7, 2015 09:40
-
-
Save zengyun-hacker/7336bddb8a18937f80ba to your computer and use it in GitHub Desktop.
how to get file name when saving a image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage *image; //The image would be save | |
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; | |
[library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)image.imageOrientation completionBlock:^(NSURL *assetURL, NSError *error) { | |
if (!error) { | |
[library assetForURL:assetURL resultBlock:^(ALAsset *asset) { | |
ALAssetRepresentation *defaultRep = [asset defaultRepresentation]; | |
NSString *fileName = [defaultRep filename]; | |
} failureBlock:^(NSError *error) { | |
}]; | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment