首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Flutter: Error (Xcode):在IOS上运行时找不到'Flutter/Flutter.h‘文件

Flutter: Error (Xcode):在IOS上运行时找不到'Flutter/Flutter.h‘文件
EN

Stack Overflow用户
提问于 2022-08-08 08:53:17
回答 2查看 562关注 0票数 0

几天前,我的项目运行良好,但今天运行时,出现了一个错误。

首先,我正常运行项目,然后得到一个错误消息,命令PhaseScriptExecution失败,一个非零的退出代码,像这样的在这里输入图像描述

我研究并跟进:Xcode 10.2.1命令PhaseScriptExecution失败,退出代码为非零

我向查询只安装并重新构建在这里输入图像描述

但是我得到了一个新的错误/Flutter.h’文件没有找到

我遵循这个链接:错误:在iOS上运行颤振时找不到' flutter /Flutter.h‘文件,但对我来说没有办法。

我的颤栗医生

代码语言:javascript
运行
复制
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale en-VN)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code (version 1.65.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

我的文件

代码语言:javascript
运行
复制
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'Firebase/Messaging'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
              '$(inherited)',

              ## dart: PermissionGroup.calendar
              # 'PERMISSION_EVENTS=1',

              ## dart: PermissionGroup.reminders
              # 'PERMISSION_REMINDERS=1',

              ## dart: PermissionGroup.contacts
               'PERMISSION_CONTACTS=1',

              ## dart: PermissionGroup.camera
               'PERMISSION_CAMERA=1',

              ## dart: PermissionGroup.microphone
              # 'PERMISSION_MICROPHONE=1',

              ## dart: PermissionGroup.speech
              # 'PERMISSION_SPEECH_RECOGNIZER=1',

              ## dart: PermissionGroup.photos
               'PERMISSION_PHOTOS=1',

              ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
              # 'PERMISSION_LOCATION=1',

              ## dart: PermissionGroup.notification
               'PERMISSION_NOTIFICATIONS=1',

              ## dart: PermissionGroup.mediaLibrary
               'PERMISSION_MEDIA_LIBRARY=1',

              ## dart: PermissionGroup.sensors
              # 'PERMISSION_SENSORS=1',

              ## dart: PermissionGroup.bluetooth
              # 'PERMISSION_BLUETOOTH=1',

              ## dart: PermissionGroup.appTrackingTransparency
              # 'PERMISSION_APP_TRACKING_TRANSPARENCY=1'
            ]
      end
  end
end

当我使用flutter run运行时,错误是

代码语言:javascript
运行
复制
ailed to build iOS app
Error output from Xcode build:
↳
    objc[2422]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf458) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1047904f8).
    One of the two will be used. Which one is undefined.
    objc[2422]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf4a8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x104790548). One of the two will be used. Which one is undefined.
    objc[2422]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf4f8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x104790598). One of the two will be used. Which one is undefined.
    objc[2422]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf548) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1047905e8). One of the
    two will be used. Which one is undefined.
    objc[2422]: Class AppleTypeCRetimerFirmwareCopier is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf598) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104790638). One
    of the two will be used. Which one is undefined.
    objc[2422]: Class ATCRTRestoreInfoFTABSubfile is implemented in both /usr/lib/libauthinstall.dylib (0x1d9fbf5e8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104790688). One of
    the two will be used. Which one is undefined.
    2022-08-08 15:50:31.871 xcodebuild[2422:318480] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
    com.apple.dt.IDEWatchSupportCore
    2022-08-08 15:50:31.871 xcodebuild[2422:318480] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
    Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/dr/g3m_83x133sgqld2s81hkcbm0000gn/T/flutter_tools.BrO096/flutter_ios_build_temp_dirz0bX8m/temporary_xcresult_bundle

    /Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    /Users/anhdinhhoangquang/cloudv/ios/Runner/GeneratedPluginRegistrant.h:10:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header
    '/Users/anhdinhhoangquang/Library/Developer/Xcode/DerivedData/Runner-hftipncmgtfzwkejzigesjjczlmu/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2VRBUORSX1OJB-clang_1S85MWRYG1P34.pch' for bridging header
    '/Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h'
    /Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    2 errors generated.
    error: generate-pch command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/anhdinhhoangquang/cloudv/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target
    'Reachability' from project 'Pods')
    /Users/anhdinhhoangquang/cloudv/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target
    'OrderedSet' from project 'Pods')
    /Users/anhdinhhoangquang/cloudv/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target
    'FMDB' from project 'Pods')
    /Users/anhdinhhoangquang/cloudv/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target
    'AppAuth' from project 'Pods')

    Result bundle written to path:
        /var/folders/dr/g3m_83x133sgqld2s81hkcbm0000gn/T/flutter_tools.BrO096/flutter_ios_build_temp_dirz0bX8m/temporary_xcresult_bundle


Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/anhdinhhoangquang/cloudv/ios/Runner/GeneratedPluginRegistrant.h:9:8


Error (Xcode): failed to emit precompiled header
'/Users/anhdinhhoangquang/Library/Developer/Xcode/DerivedData/Runner-hftipncmgtfzwkejzigesjjczlmu/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2VRBUORSX1OJB-clang_1S85MWRYG1P34.pch' for bridging header
'/Users/anhdinhhoangquang/cloudv/ios/Runner/Runner-Bridging-Header.h'


Could not build the application for the simulator.
Error launching application on iPhone 13 Pro Max.

我也是由Xcode构建的,并得到了类似于这个图像在这里输入图像描述的错误

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-08-08 09:24:19

你可以试着这样做:

  1. 备份Runner文件夹
  2. 删除ios文件夹3.切换到终端并在颤振项目文件夹中执行flutter create .
  3. 将您的Runner文件夹粘贴回ios文件夹
  4. pod deintegrate文件夹中的ios
  5. pod install也在ios文件夹中
  6. 颤振项目文件夹中的flutter clean
  7. flutter pub get
  8. flutter run

请注意,如果使用firebase,则需要重新插入GoogleService-Info.plist文件。

票数 0
EN

Stack Overflow用户

发布于 2022-08-08 09:22:51

打开iOS文件夹Podfile并取消评论平台行,并将其更改为11

代码语言:javascript
运行
复制
platform :ios, '11.0'

并在终端中打开ios文件夹并运行。

pod install

并在xcode中打开iOS项目,并确保您的pod部署目标更改为11。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73275198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档