我正在開發一個使用cordova 構建iOS 和Android 的混合專案。
我的問題是 iOS 上傳。有一個“上傳”照片的選項,用戶也可以“拍照”。為此,我使用了cordova-plugin-ios-camera-permissions。
在我的 config.xml 中,我添加了以下權限:
<platform name="ios">
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>need camera access to take pictures</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to upload images</string>
</edit-config>
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
<edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to save pictures there</string>
</edit-config>
</platform>
但是當用戶點擊“拍攝視頻”時,應用程式崩潰,因為沒有使用麥克風的權限(NSMicrophoneUsageDescription)。
我認為可以通過將此權限添加到 PList.info(通過 config.xml)來解決問題,但是......我的應用程式中沒有“上傳視頻”功能......
我的問題是:是否可以阻止“拍攝視頻”或者我應該簡單地添加麥克風權限?
uj5u.com熱心網友回復:
我已經通過使用輸入“接受”屬性阻止視頻型別來解決它:
<input type="file" accept="image/*" id="my_file" />
結果,iOS 沒有顯示“拍攝視頻”選項。
完整的參考可以在以下位置找到:https ://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/466746.html
標籤:IOS 苹果手机 科尔多瓦 ios相机 ios-隐私设置
上一篇:VoxeetUXKitCordova-無法安裝缺少“Carthage/Build/VoxeetUXKit.xcframework”的cordova插件
