use Photos framework to export xmp data into the iOS Photo Gallery
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>Save the pano image in the user gallery</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Export the panoramic to the gallery</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
AD1063AC1EC7AE92002A525F /* node_viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10637B1EC7ADFA002A525F /* node_viewport.cpp */; };
|
||||
AD29CC621EA2B214008C8BFA /* action.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD29CC601EA2B214008C8BFA /* action.cpp */; };
|
||||
AD30D82F1F783E0100B6A112 /* libcurl.4.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AD30D82E1F783E0100B6A112 /* libcurl.4.tbd */; };
|
||||
AD30D8331F8049BD00B6A112 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD30D8321F8049BC00B6A112 /* Photos.framework */; };
|
||||
AD3B1EC01E3B8B7600E918E3 /* layout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD3B1EBE1E3B8B7600E918E3 /* layout.cpp */; };
|
||||
AD4C08D91E89BD0F0051D85F /* asset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08CF1E89BD0F0051D85F /* asset.cpp */; };
|
||||
AD4C08DA1E89BD0F0051D85F /* bezier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D11E89BD0F0051D85F /* bezier.cpp */; };
|
||||
@@ -285,6 +286,7 @@
|
||||
AD29CC601EA2B214008C8BFA /* action.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = action.cpp; sourceTree = "<group>"; };
|
||||
AD29CC611EA2B214008C8BFA /* action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = action.h; sourceTree = "<group>"; };
|
||||
AD30D82E1F783E0100B6A112 /* libcurl.4.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.4.tbd; path = usr/lib/libcurl.4.tbd; sourceTree = SDKROOT; };
|
||||
AD30D8321F8049BC00B6A112 /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/Photos.framework; sourceTree = DEVELOPER_DIR; };
|
||||
AD3B1EBE1E3B8B7600E918E3 /* layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = layout.cpp; sourceTree = "<group>"; };
|
||||
AD3B1EBF1E3B8B7600E918E3 /* layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout.h; sourceTree = "<group>"; };
|
||||
AD4C08CF1E89BD0F0051D85F /* asset.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = asset.cpp; sourceTree = "<group>"; };
|
||||
@@ -383,6 +385,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AD30D8331F8049BD00B6A112 /* Photos.framework in Frameworks */,
|
||||
AD759B691F279B3900211963 /* GLKit.framework in Frameworks */,
|
||||
ADD7D2B31EBFA42C00D5A897 /* Security.framework in Frameworks */,
|
||||
ADD7D2B11EBFA42600D5A897 /* libz.tbd in Frameworks */,
|
||||
@@ -575,6 +578,7 @@
|
||||
AD759B631F2793AD00211963 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AD30D8321F8049BC00B6A112 /* Photos.framework */,
|
||||
AD30D82E1F783E0100B6A112 /* libcurl.4.tbd */,
|
||||
AD759B661F27964D00211963 /* GLKit.framework */,
|
||||
AD759B641F2793AE00211963 /* OpenGLES.framework */,
|
||||
|
||||
@@ -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