Skip to content

Commit 0d979a7

Browse files
committed
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 4af3ca4 commit 0d979a7

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

modules/videoio/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ if(IOS)
219219
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_photo_camera.mm
220220
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_video_camera.mm)
221221

222-
list(APPEND VIDEOIO_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework AssetsLibrary")
223-
if(APPLE_FRAMEWORK)
224-
list(APPEND VIDEOIO_LIBRARIES "-framework UIKit")
225-
endif()
222+
list(APPEND VIDEOIO_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit")
226223
endif()
227224

228225
if(WIN32)

modules/videoio/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/videoio/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;}
@@ -626,11 +626,7 @@ - (void)saveVideo;
626626
return;
627627
}
628628

629-
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
630-
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
631-
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
632-
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
633-
}
629+
UISaveVideoAtPathToSavedPhotosAlbum([self videoFileString], nil, nil, NULL);
634630
}
635631

636632

0 commit comments

Comments
 (0)