use Photos framework to export xmp data into the iOS Photo Gallery
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Foundation/Foundation.h>
|
||||
#import <Photos/Photos.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -837,8 +838,18 @@ void ui::Canvas::export_equirectangular(std::string data_path)
|
||||
inject_xmp(name);
|
||||
//int ret = stbi_write_png(name, m_latlong.getWidth(), m_latlong.getHeight(), 4, latlong_data.get(), m_latlong.stride());
|
||||
#ifdef __IOS__
|
||||
image = [UIImage imageWithContentsOfFile:[NSString stringWithUTF8String:name]];
|
||||
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
|
||||
NSURL* url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:name]];
|
||||
PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:url];
|
||||
changeRequest.creationDate = [NSDate date];
|
||||
} completionHandler:^(BOOL success, NSError *error) {
|
||||
if (success) {
|
||||
NSLog(@"successfully saved");
|
||||
}
|
||||
else {
|
||||
NSLog(@"error saving to photos: %@", error);
|
||||
}
|
||||
}];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user