意见反馈相册权限bug

This commit is contained in:
lianxiang 2018-09-30 11:04:16 +08:00
parent fc47921130
commit ea869e7b42
3 changed files with 49 additions and 3 deletions

View File

@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
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

View File

@ -7,7 +7,7 @@
//
#import "GiGaHelper.h"
#import <Photos/Photos.h>
@implementation GiGaHelper
+(NSString *) getNowTimeString{
@ -294,4 +294,5 @@
}
@end

View File

@ -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<UIImagePickerControllerInfoKey,id> *)info
{
[picker dismissViewControllerAnimated:YES completion:nil];
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];