Skip to content

Commit 6bb51a8

Browse files
committed
Temp solution to fix Xcode 11 Beta's SDK API declaration for macOS
1 parent 7e92c06 commit 6bb51a8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "SDWebImage/SDWebImage" "5.0.0"
1+
github "SDWebImage/SDWebImage" "5.1.0"

Example/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- Expecta (1.0.6)
3-
- SDWebImage/Core (5.0.0)
3+
- SDWebImage/Core (5.1.0)
44
- SDWebImagePhotosPlugin (0.2.1):
55
- SDWebImage/Core (~> 5.0)
66

@@ -19,9 +19,9 @@ EXTERNAL SOURCES:
1919

2020
SPEC CHECKSUMS:
2121
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
22-
SDWebImage: 5de80a0302de9e377e62f47d2fa1304efff0e55f
22+
SDWebImage: fb387001955223213dde14bc08c8b73f371f8d8f
2323
SDWebImagePhotosPlugin: 3a126667559b206b91d6ca6edacdc58dcaa9b2cd
2424

2525
PODFILE CHECKSUM: 60756e45d1da564a14e0e1964ffd639deadc2855
2626

27-
COCOAPODS: 1.6.1
27+
COCOAPODS: 1.7.5

SDWebImagePhotosPlugin/Classes/SDWebImagePhotosLoader.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
#import "PHImageRequestOptions+SDWebImagePhotosPlugin.h"
1313
#import "SDWebImagePhotosError.h"
1414
#import <objc/runtime.h>
15+
16+
// Compatible
1517
#if SD_UIKIT
1618
#import <MobileCoreServices/MobileCoreServices.h>
1719
typedef UIImageOrientation SDImageOrientation;
1820
#else
1921
typedef CGImagePropertyOrientation SDImageOrientation;
2022
#endif
23+
// This protocol is used to fix the Xcode 11's API declaration for macOS. Which should be available on macOS 10.13
24+
@protocol PHImageManager <NSObject>
25+
- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset options:(nullable PHImageRequestOptions *)options resultHandler:(void(^)(NSData *__nullable imageData, NSString *__nullable dataUTI, SDImageOrientation orientation, NSDictionary *__nullable info))resultHandler;
26+
@end
27+
@interface PHImageManager () <PHImageManager>
28+
@end
2129

2230
@interface SDWebImagePhotosLoaderOperation : NSObject <SDWebImageOperation>
2331

@@ -287,7 +295,7 @@ - (void)fetchImageDataWithAsset:(PHAsset *)asset operation:(SDWebImagePhotosLoad
287295
}
288296

289297
__weak typeof(operation) weakOperation = operation;
290-
PHImageRequestID requestID = [[PHImageManager defaultManager] requestImageDataForAsset:asset options:requestOptions resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, SDImageOrientation orientation, NSDictionary * _Nullable info) {
298+
PHImageRequestID requestID = [(id<PHImageManager>)[PHImageManager defaultManager] requestImageDataForAsset:asset options:requestOptions resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, SDImageOrientation orientation, NSDictionary * _Nullable info) {
291299
if (weakOperation.isCancelled) {
292300
// Cancelled
293301
NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:nil];

0 commit comments

Comments
 (0)