Skip to content

Commit 621a1d3

Browse files
StatusReportalalek
authored andcommitted
videoio: remove AssetsLibrary dependency.
The entire AssetsLibrary framework is deprecated since iOS 8.0. The code used in the camera example code can use UIKit to save videos to the camera instead, which allows to avoid linking with PhotoKit instead to prevent increasing the iOS deployment target.
1 parent 14b686c commit 621a1d3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

modules/highgui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ endif(HAVE_INTELPERC)
241241
if(IOS)
242242
add_definitions(-DHAVE_IOS=1)
243243
list(APPEND highgui_srcs src/ios_conversions.mm src/cap_ios_abstract_camera.mm src/cap_ios_photo_camera.mm src/cap_ios_video_camera.mm)
244-
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework AssetsLibrary")
244+
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit")
245245
endif()
246246

247247
if(WIN32)

modules/highgui/src/cap_ios_video_camera.mm

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#import "opencv2/highgui/cap_ios.h"
3333
#include "precomp.hpp"
34-
#import <AssetsLibrary/AssetsLibrary.h>
34+
#import <UIKit/UIKit.h>
3535

3636

3737
static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
@@ -595,11 +595,7 @@ - (void)saveVideo;
595595
return;
596596
}
597597

598-
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
599-
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
600-
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
601-
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
602-
}
598+
UISaveVideoAtPathToSavedPhotosAlbum([self videoFileString], nil, nil, NULL);
603599
}
604600

605601

0 commit comments

Comments
 (0)