在使用 Xcode 构建 Flutter 相机应用程序时,如何解决 camera_avfoundation not found 错误?

问题描述 投票:0回答:0
When I build a camera app made with Flutter in Xcode, it keeps saying that camera_avfoundation cannot be found. So, as shown below, I installed the dependency in pubspec.yaml and performed flutter pub get, and when I applied the same dependency to the podfile and ran pod install, the following error occurred, and the error that camera_avfoundation was not found continued to appear.. How should I set it up? Can I successfully build a camera app?

[pod install error]

Analyzing dependencies
[!] Unable to find a specification for `camera (~> 0.10.5)`

You have either:
  * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
  * mistyped the name or version.
  * not added the source repo that hosts the Podspec to your Podfile.

[pubspec.yaml]

name: brix
description: A new Flutter project.

publish_to: 'none'


version: 1.0.0+1

environment:
   sdk: '>=3.0.0 <4.0.0'


dependencies:
   flutter:
     sdk: flutter
   camera : ^0.10.5
   path_provider: ^2.0.15
   gallery_saver: ^2.3.2
   logger: ^1.3.0
   camera_avfoundation: ^0.9.13+1


dev_dependencies:
   flutter_test:
     sdk: flutter

   flutter_lints: ^2.0.0

flutter:
   assets:
     - assets/background_login.jpeg
     - assets/background.jpeg

     - assets/naver_login.jpeg
     - assets/kakao_login.jpeg

     - assets/camera_icon.jpeg
     - assets/shopping_icon.jpeg
     - assets/event_icon.jpeg

     - assets/board_icon.jpeg
     - assets/question_icon.jpeg
     - assets/settings_icon.jpeg

[Podfile]

platform :ios, '11.0'

source 'https://cdn.cocoapods.org/'

target 'Runner' do
   # Comment the next line if you don't want to use dynamic frameworks
   use_frameworks!

   # Pods for Runners
   pod 'camera', '~> 0.10.5'
   pod 'path_provider', '~> 2.0.15'
   pod 'gallery_saver', '~> 2.3.2'
   pod 'logger', '~> 1.3.0'
   pod 'camera_avfoundation', '~> 0.9.13+1'

   target 'RunnerTests' do
     inherit! :search_paths
     # Pods for testing
   end
end

不知是不是没有从camera.dart导入camera_avfoundation的语法,所以建包的时候找不到,

导入“包:camera_avfoundation/camera_avfoundation.dart”;

添加语法后构建,但是构建也失败,同样的错误

扑干净 rm-Podfile rm -rf Podfile.lock 吊舱安装 pod 回购更新 我还在 Xcode 中使用干净的构建文件夹对其进行了初始化。

info.plist podfile pubspec.yaml podfile-lock
© www.soinside.com 2019 - 2024. All rights reserved.