|
11 | 11 | @implementation AppDelegate
|
12 | 12 |
|
13 | 13 | - (BOOL)application:(UIApplication *)application
|
14 |
| -didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
15 |
| - [GeneratedPluginRegistrant registerWithRegistry:self]; |
16 |
| - |
17 |
| - if (@available(iOS 14, *)) { |
18 |
| - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; |
19 |
| - __block NSError *saveError = nil; |
20 |
| - [PHPhotoLibrary requestAuthorizationForAccessLevel:PHAccessLevelAddOnly handler:^(PHAuthorizationStatus status) { |
21 |
| - if (![PHPhotoLibrary.sharedPhotoLibrary performChangesAndWait:^{ |
22 |
| - NSURL *jpgImageTall = [bundle URLForResource:@"jpgImageTall" withExtension:@"jpg"]; |
23 |
| - [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:jpgImageTall]; |
24 |
| - } error:&saveError]) { |
25 |
| - os_log_error(OS_LOG_DEFAULT, "%@", saveError); |
26 |
| - } |
27 |
| - }]; |
28 |
| - } |
29 |
| - return [super application:application didFinishLaunchingWithOptions:launchOptions]; |
| 14 | + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
| 15 | + [GeneratedPluginRegistrant registerWithRegistry:self]; |
| 16 | + |
| 17 | + if (@available(iOS 14, *)) { |
| 18 | + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; |
| 19 | + __block NSError *saveError = nil; |
| 20 | + [PHPhotoLibrary |
| 21 | + requestAuthorizationForAccessLevel:PHAccessLevelAddOnly |
| 22 | + handler:^(PHAuthorizationStatus status) { |
| 23 | + if (![PHPhotoLibrary.sharedPhotoLibrary |
| 24 | + performChangesAndWait:^{ |
| 25 | + NSURL *jpgImageTall = |
| 26 | + [bundle URLForResource:@"jpgImageTall" |
| 27 | + withExtension:@"jpg"]; |
| 28 | + [PHAssetChangeRequest |
| 29 | + creationRequestForAssetFromImageAtFileURL: |
| 30 | + jpgImageTall]; |
| 31 | + } |
| 32 | + error:&saveError]) { |
| 33 | + os_log_error(OS_LOG_DEFAULT, "%@", saveError); |
| 34 | + } |
| 35 | + }]; |
| 36 | + } |
| 37 | + return [super application:application didFinishLaunchingWithOptions:launchOptions]; |
30 | 38 | }
|
31 | 39 |
|
32 | 40 | @end
|
0 commit comments