Skip to content

Commit 4bebeb4

Browse files
committed
Format
1 parent c1bef85 commit 4bebeb4

File tree

1 file changed

+24
-16
lines changed
  • packages/image_picker/image_picker_ios/example/ios/Runner

1 file changed

+24
-16
lines changed

packages/image_picker/image_picker_ios/example/ios/Runner/AppDelegate.m

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,30 @@
1111
@implementation AppDelegate
1212

1313
- (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];
3038
}
3139

3240
@end

0 commit comments

Comments
 (0)