Examples are as follows:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; if ( == UIImagePickerControllerSourceTypeCamera) { UIImageWriteToSavedPhotosAlbum(image,self,@selector(image:didFinishSavingWithError:contextInfo:),NULL); } } - (void)image:(UIImage*)image didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo { if (error) { DLog(@"Image saving failed!"); }else{ DLog(@"The picture was saved successfully!"); } } This method can save pictures from other sources to photo albums //Stored into the album when the image is retrieved from the camera //Save method 1// UIImageWriteToSavedPhotosAlbum(,self,@selector(image:didFinishSavingWithError:contextInfo:),NULL); // imageData = nil; WEAKSELF //Save method 2 and get the saved photo file name at the same time __blockALAssetsLibrary *lib = [[ALAssetsLibraryalloc] init]; [lib writeImageToSavedPhotosAlbum::nilcompletionBlock:^(NSURL *assetURL,NSError *error) { ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *imageAsset) { ALAssetRepresentation *imageRep = [imageAssetdefaultRepresentation]; = [NSStringstringWithFormat:@"%@",[imageRepfilename]]; NSLog(@"[imageRep filename 1] : %@", [imageRepfilename]); DBLog(@"Take a photo0 = %@",); commitBlock(,UIImageJPEGRepresentation(,0.5),); }; ALAssetsLibrary* assetslibrary = [[ALAssetsLibraryalloc] init]; [assetslibrary assetForURL:assetURLresultBlock:resultblock failureBlock:nil]; NSLog(@"assetURL = %@, error = %@", assetURL, error); lib = nil; }]; }];
The example of saving pictures to the album and obtaining the image file name in iOS is all the content I share with you. I hope you can give you a reference and I hope you can support me more.