diff --git a/GIGA/Common/GiGaHelper.h b/GIGA/Common/GiGaHelper.h index 1cc80f8..a44c795 100644 --- a/GIGA/Common/GiGaHelper.h +++ b/GIGA/Common/GiGaHelper.h @@ -7,7 +7,7 @@ // #import - +NS_ASSUME_NONNULL_BEGIN @interface GiGaHelper : NSObject /** * 获取当前时间 格式 yyyy-MM-dd hh:mm:ss @@ -70,4 +70,6 @@ +(NSString*)dictionaryToJson:(NSDictionary *)dic; +NS_ASSUME_NONNULL_END + @end diff --git a/GIGA/Common/GiGaHelper.m b/GIGA/Common/GiGaHelper.m index 3c48fae..d520774 100644 --- a/GIGA/Common/GiGaHelper.m +++ b/GIGA/Common/GiGaHelper.m @@ -7,7 +7,7 @@ // #import "GiGaHelper.h" - +#import @implementation GiGaHelper +(NSString *) getNowTimeString{ @@ -294,4 +294,5 @@ } + @end diff --git a/GIGA/Modules/Me/Controller/GiGaFeedBackViewController.m b/GIGA/Modules/Me/Controller/GiGaFeedBackViewController.m index 81e06e0..5026e41 100644 --- a/GIGA/Modules/Me/Controller/GiGaFeedBackViewController.m +++ b/GIGA/Modules/Me/Controller/GiGaFeedBackViewController.m @@ -357,7 +357,7 @@ } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { if (buttonIndex == 0) { - [self satartCamera]; + [self digPhotoAuth]; }else if (buttonIndex == 1){ [self fromAlbums]; } @@ -390,6 +390,7 @@ -(void)satartCamera{ + GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]]; if ((cell.images.count + 1) > 6) { GIGA_ShowToast(@"最多六张"); @@ -432,6 +433,47 @@ } +-(void)digPhotoAuth{ + + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){ + + switch (status) { + + case PHAuthorizationStatusNotDetermined: + { + NSLog(@"用户还没有做出选择"); + break; + } + case PHAuthorizationStatusAuthorized: + { + + NSLog(@"用户允许当前应用访问相册"); + // 拍照后本app需保存到相册 + [self satartCamera]; + + break; + } + case PHAuthorizationStatusDenied: + { + //NSLog(@"用户拒绝当前应用访问相册,我们需要提醒用户打开访问开关"); + GIGA_ShowToast(@"拒绝当前应用访问相册,请在系统设置中允许访问"); + break; + } + case PHAuthorizationStatusRestricted: + { + NSLog(@"家长控制,不允许访问"); + break; + } + default: + { + NSLog(@"default"); + break; + } + } + + }]; + +} - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{ [picker dismissViewControllerAnimated:YES completion:nil]; @@ -439,6 +481,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { + [picker dismissViewControllerAnimated:YES completion:nil]; GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];