Browse Source

修改ios配置

3860082966@qq.com 22 hours ago
parent
commit
d73dd18312
3 changed files with 36 additions and 1 deletions
  1. 4 0
      ios/App/App.xcodeproj/project.pbxproj
  2. 28 1
      ios/App/App/AppDelegate.swift
  3. 4 0
      ios/App/App/Info.plist

+ 4 - 0
ios/App/App.xcodeproj/project.pbxproj

@@ -347,6 +347,7 @@
 			baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
 			baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = NSG48HG58T;
 				DEVELOPMENT_TEAM = NSG48HG58T;
@@ -357,6 +358,7 @@
 				OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
 				OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
 				PRODUCT_BUNDLE_IDENTIFIER = com.heychat.live;
 				PRODUCT_BUNDLE_IDENTIFIER = com.heychat.live;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				PROVISIONING_PROFILE_SPECIFIER = "";
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
 				SWIFT_VERSION = 5.0;
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TARGETED_DEVICE_FAMILY = "1,2";
@@ -368,6 +370,7 @@
 			baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
 			baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = NSG48HG58T;
 				DEVELOPMENT_TEAM = NSG48HG58T;
@@ -377,6 +380,7 @@
 				MARKETING_VERSION = 1.0;
 				MARKETING_VERSION = 1.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.heychat.live;
 				PRODUCT_BUNDLE_IDENTIFIER = com.heychat.live;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				PROVISIONING_PROFILE_SPECIFIER = "";
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
 				SWIFT_VERSION = 5.0;
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				TARGETED_DEVICE_FAMILY = "1,2";

+ 28 - 1
ios/App/App/AppDelegate.swift

@@ -1,6 +1,6 @@
 import UIKit
 import UIKit
 import Capacitor
 import Capacitor
-
+import AVFoundation
 @UIApplicationMain
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
 
@@ -8,9 +8,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
 
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         // Override point for customization after application launch.
         // Override point for customization after application launch.
+        // 请求相机和麦克风权限
+        requestCameraPermission()
+        requestMicrophonePermission()
         return true
         return true
     }
     }
+    // 请求相机权限
+    func requestCameraPermission() {
+        AVCaptureDevice.requestAccess(for: .video) { granted in
+            DispatchQueue.main.async {
+                if granted {
+                    print("相机权限已授予")
+                } else {
+                    print("相机权限被拒绝")
+                }
+            }
+        }
+    }
 
 
+    // 请求麦克风权限
+    func requestMicrophonePermission() {
+        AVAudioSession.sharedInstance().requestRecordPermission { granted in
+            DispatchQueue.main.async {
+                if granted {
+                    print("麦克风权限已授予")
+                } else {
+                    print("麦克风权限被拒绝")
+                }
+            }
+        }
+    }
     func applicationWillResignActive(_ application: UIApplication) {
     func applicationWillResignActive(_ application: UIApplication) {
         // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
         // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
         // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
         // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.

+ 4 - 0
ios/App/App/Info.plist

@@ -50,6 +50,10 @@
 	<key>NSCameraUsageDescription</key>
 	<key>NSCameraUsageDescription</key>
 	<string>我们需要访问您的相机以进行拍照和视频直播推流。</string>
 	<string>我们需要访问您的相机以进行拍照和视频直播推流。</string>
 
 
+	<!-- 麦克风权限 -->
+	<key>NSMicrophoneUsageDescription</key>
+	<string>我们需要访问您的麦克风以进行语音和视频直播推流。</string>
+
 	<!-- 照片库权限(可选) -->
 	<!-- 照片库权限(可选) -->
 	<key>NSPhotoLibraryUsageDescription</key>
 	<key>NSPhotoLibraryUsageDescription</key>
 	<string>我们需要访问您的照片库以选择照片。</string>
 	<string>我们需要访问您的照片库以选择照片。</string>