Flutter ios错误:在构建和运行时使用未声明的标识符

ltqd579y  于 5个月前  发布在  iOS
关注(0)|答案(1)|浏览(70)

我试图在iOS上构建我的Flutter应用程序,它已经在Android上运行我的xcode.我的xcode版本是13.3,运行Flutter医生后,我的Flutter设置似乎很好,当我尝试使用模拟器在iOS上运行我的Flutter代码时,我一直得到这个错误

/Users/anthony/.pub-cache/hosted/pub.dev/just_audio-0.9.36/macos/Classes/UriAudioSource.m:53:38: error: use of undeclared identifier 'AVURLAssetHTTPUserAgentKey'; did you mean 'AVURLAssetHTTPCookiesKey'?
                        assetOptions[AVURLAssetHTTPUserAgentKey] = userAgent;
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                     AVURLAssetHTTPCookiesKey
In module 'AVFoundation' imported from /Users/anthony/.pub-cache/hosted/pub.dev/just_audio-0.9.36/macos/Classes/IndexedPlayerItem.h:1:
AVF_EXPORT NSString *const AVURLAssetHTTPCookiesKey API_AVAILABLE(macos(10.15), ios(8.0), tvos(9.0), watchos(1.0));
                           ^
1 error generated.
** BUILD FAILED **

Exception: Build process failed

字符串
如果我尝试运行flutter build ios,它会出现类似的错误。

Running Xcode build...                                                  
Xcode build done.                                           72.6s
Failed to build iOS app
Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Semantic Issue (Xcode): Use of undeclared identifier 'AVURLAssetHTTPUserAgentKey'; did you mean 'AVURLAssetHTTPCookiesKey'?
/Users/anthony/.pub-cache/hosted/pub.dev/just_audio-0.9.36/ios/Classes/UriAudioSource.m:52:37

Error (Xcode): Interrupted

Encountered error while building for device.


我已经删除了我的ios文件夹并重新启动了应用程序,但它并没有消失。我在flutter上使用的库是:

dependencies:
  animated_list_plus: ^0.5.2
  carousel_slider: ^4.2.1
  confetti: ^0.7.0
  cupertino_icons: ^1.0.2
  dropdown_button2: ^2.3.9
  easy_pie_chart: ^1.0.0
  either_dart: ^1.0.0
  equatable: ^2.0.5
  expandable: ^5.0.1
  expandable_widgets: ^1.0.3+1
  file_picker: ^5.2.0
  firebase_analytics: ^10.7.2
  firebase_core: ^2.24.0
  firebase_remote_config: ^4.3.6
  fl_chart: ^0.63.0
  flutter:
    sdk: flutter
  flutter_bloc: ^8.1.3
  flutter_local_notifications: ^16.1.0
  flutter_localizations:
    sdk: flutter
  flutter_slidable: ^3.0.0
  flutter_svg: ^2.0.7
  flutter_timezone: ^1.0.8
  flutter_widget_from_html: ^0.14.6
  fluttertoast: ^8.2.2
  google_mobile_ads: ^4.0.0
  grouped_list: ^5.1.2
  hive_flutter: ^1.1.0
  html_editor_enhanced: ^2.5.1
  infinite_listview: ^1.1.0
  intl: ^0.18.0
  lottie: ^2.6.0
  page_transition: ^2.1.0
  percent_indicator: ^4.2.3
  permission_handler: ^10.4.5
  responsive_sizer: ^3.2.0
  scroll_date_picker: ^3.7.3
  smooth_page_indicator: ^1.1.0
  step_progress_indicator: ^1.0.2
  tab_container: ^2.0.0
  table_calendar: ^3.0.9
  timer_count_down: ^2.2.2
  timezone: ^0.9.2
  url_launcher: ^6.0.8
  uuid: ^4.1.0

olqngx59

olqngx591#

AVURLAssetHTTPUserAgentKey至少需要iOS 16,请参阅developer.apple.com的官方文档。
您使用的是Xcode 13.3,它只支持iOS 15.4,请参阅developer.apple.com的官方文档。
你有几个选择,最简单的是升级到至少Xcode 14来构建iOS 16。
如果您使用的是旧版本的macOS,并且无法升级Xcode,则需要将just_audio软件包降级为v0.9.35,因为AVURLAssetHTTPUserAgentKey的使用是在该版本中首次引入的,请参阅github.com。将其添加到pubspec.yaml应该足够了:

dependencies:
  just_audio: 0.9.35

字符串

相关问题