|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
#import "SLImagePickerAndUpload.h"
|
|
#import "SLImagePickerAndUpload.h"
|
|
#import "UIImagePickerController+YMBlocks.h"
|
|
#import "UIImagePickerController+YMBlocks.h"
|
|
|
|
+#import <AVFoundation/AVFoundation.h>
|
|
|
|
|
|
@implementation SLImagePickerAndUpload
|
|
@implementation SLImagePickerAndUpload
|
|
|
|
|
|
@@ -17,27 +18,23 @@
|
|
switch (index) {
|
|
switch (index) {
|
|
case 0:
|
|
case 0:
|
|
{
|
|
{
|
|
-
|
|
|
|
-// //判断相机权限
|
|
|
|
-// AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
|
|
|
-// if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
|
|
|
|
-// {
|
|
|
|
-// //无权限
|
|
|
|
-// UIAlertController * alertView = [UIAlertController alertWithTitle:@"允许相机访问" message:@"请在iOS”设置-隐私-相机“选项中,允许访问您的相机!" buttonIndex:^(NSInteger index) {
|
|
|
|
-// if (index == 0) {
|
|
|
|
-// NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
|
-//
|
|
|
|
-// if([[UIApplication sharedApplication] canOpenURL:url]) {
|
|
|
|
-//
|
|
|
|
-// NSURL*url =[NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
|
-// [[UIApplication sharedApplication] openURL:url];
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } cancelButtonTitle:@"确定" otherButtonTitles:@"取消", nil];
|
|
|
|
-// [alertView show];
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
|
|
+ //判断相机权限
|
|
|
|
+ AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
|
|
|
+ if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
|
|
|
|
+ {
|
|
|
|
+ [SLCustomizeAlert showAletrWithTitle:@"允许相机访问" message:@"请在iOS”设置-隐私-相机“选项中,允许访问您的相机" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
|
|
|
|
+ if (index == 0) {
|
|
|
|
+ NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
|
+ if([[UIApplication sharedApplication] canOpenURL:url]) {
|
|
|
|
+ NSURL*url =[NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
|
+ [[UIApplication sharedApplication] openURL:url];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } cancelBtnAction:^{
|
|
|
|
+
|
|
|
|
+ }];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
[weakSelf addPicEvent:nil type:UIImagePickerControllerSourceTypeCamera];
|
|
[weakSelf addPicEvent:nil type:UIImagePickerControllerSourceTypeCamera];
|
|
}
|
|
}
|
|
break;
|
|
break;
|