Przeglądaj źródła

1.修改iOS Apex Drivers相机未取得授权提示。

Pen Li 7 lat temu
rodzic
commit
454e4ecae6

+ 13 - 1
Redant Drivers/Apex And Drivers/Camera/RACameraViewController.m

@@ -77,6 +77,18 @@
                         [self.captureSession startRunning];
                     }
                     
+                } else {
+                    
+                    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
+                    NSString *appName = [infoDict objectForKey:@"CFBundleDisplayName"];
+                    __weak typeof(self) weakSelf = self;
+                    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"Camera access denied, please change %@ setting, allow App use camera. (setting -> privacy -> camera enable %@)",[UIDevice currentDevice].model,appName] preferredStyle:UIAlertControllerStyleAlert];
+                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                        [weakSelf dismissViewControllerAnimated:YES completion:nil];
+                    }];
+                    [alert addAction:action];
+                    [self presentViewController:alert animated:YES completion:nil];
+                    
                 }
             });
             
@@ -147,7 +159,7 @@
     if (![self camerAuthorization]) {
         
         NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
-        NSString *appName = [infoDict objectForKey:@"CFBundleName"];
+        NSString *appName = [infoDict objectForKey:@"CFBundleDisplayName"];
         __weak typeof(self) weakSelf = self;
         UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"Camera access denied, please change %@ setting, allow App use camera. (setting -> privacy -> camera enable %@)",[UIDevice currentDevice].model,appName] preferredStyle:UIAlertControllerStyleAlert];
         UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {