Skip to content

Commit

Permalink
Fix compile error on Xcode 12 for iOS 14 (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Oct 20, 2021
1 parent f4b9a1a commit e4569f1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build_test.yml
@@ -1,6 +1,10 @@
name: Build test

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
test_iOS:
Expand All @@ -21,6 +25,7 @@ jobs:
- run: flutter pub get
- run: flutter pub publish --dry-run
- run: flutter analyze lib example/lib
- run: /usr/bin/xcodebuild -version
- run: cd example ; flutter build ios --no-codesign

test_macOS:
Expand All @@ -37,11 +42,12 @@ jobs:
- uses: subosito/flutter-action@v1
with:
channel: stable
- run: flutter config --enable-macos-desktop
- run: ./copy_on_publish.sh
- run: flutter pub get
- run: flutter pub publish --dry-run
- run: flutter analyze lib example/lib
- run: flutter config --enable-macos-desktop
- run: /usr/bin/xcodebuild -version
- run: cd example ; flutter build macos --debug

test_android:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.3.9+1
Fixes:
- Fix compile error on Xcode 12 for iOS 14. (#630)

## 1.3.9
Fixes:
- Fix `presentLimited` issues on iOS 14 real devices. (#627)
Expand Down
12 changes: 7 additions & 5 deletions ios/Classes/PMPlugin.m
Expand Up @@ -145,7 +145,7 @@ - (void)requestPermissionStatus:(int)requestAccessLevel
}

- (void)presentLimited:(ResultHandler*)handler {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
#if __IPHONE_14_0
if (@available(iOS 14, *)) {
UIViewController* controller = [self getCurrentViewController];
if (!controller) {
Expand All @@ -155,7 +155,7 @@ - (void)presentLimited:(ResultHandler*)handler {
details:nil]];
return;
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
#if __IPHONE_15_0
if (@available(iOS 15, *)) {
[PHPhotoLibrary.sharedPhotoLibrary
presentLimitedLibraryPickerFromViewController: controller
Expand All @@ -170,17 +170,19 @@ - (void)presentLimited:(ResultHandler*)handler {
[PHPhotoLibrary.sharedPhotoLibrary presentLimitedLibraryPickerFromViewController: controller];
[handler reply:nil];
#endif
return;
}
#endif
#else
[handler reply:nil];
#endif
}
#endif

#if TARGET_OS_OSX
- (void)handlePermission:(PMManager *)manager
handler:(ResultHandler*)handler
requestAccessLevel:(int)requestAccessLevel {
#if __MAC_OS_VERSION_MAX_ALLOWED >= __MAC_11_0
#if __MAC_11_0
if (@available(macOS 11.0, *)) {
[PHPhotoLibrary requestAuthorizationForAccessLevel:requestAccessLevel handler:^(PHAuthorizationStatus status) {
[self replyPermssionResult:handler status:status];
Expand All @@ -199,7 +201,7 @@ - (void)handlePermission:(PMManager *)manager

- (void)requestPermissionStatus:(int)requestAccessLevel
completeHandler:(void (^)(PHAuthorizationStatus status))completeHandler {
#if __MAC_OS_VERSION_MAX_ALLOWED >= __MAC_11_0
#if __MAC_11_0
if (@available(macOS 11.0, *)) {
[PHPhotoLibrary requestAuthorizationForAccessLevel:requestAccessLevel handler:^(PHAuthorizationStatus status) {
completeHandler(status);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: photo_manager
description: You can scan photos and albums. Only api, not have ui. you can use the api to create your image picker. or use photo
version: 1.3.9
version: 1.3.9+1
homepage: https://github.com/CaiJingLong/flutter_photo_manager
# author: caijinglong<cjl_spy@163.com>

Expand Down

0 comments on commit e4569f1

Please sign in to comment.