xcode 不确定如何修复此Flutter错误,nb_utils问题

s4chpxco  于 2023-03-04  发布在  Flutter
关注(0)|答案(1)|浏览(135)

在过去的几天里,我一直在尝试在iOS上构建时遇到这个相同的问题。我在网上尝试了大量不同的假设解决方案,但都没有成功。如果最近有人遇到这个问题并知道如何解决它,请让我知道。任何和所有的帮助都将非常感谢,并提前感谢您。下面是错误输出,flutter医生输出,flutter版本,Xcode版本,和我的播客文件。也请让我知道,如果有任何其他信息,我可以提供帮助。

    • 错误输出**

正在调试模式下启动iPhone 14 Pro Max上的lib/main. dart ...运行pod安装...运行Xcode构建... Xcode构建完成。45.9s无法构建iOS应用Xcode构建的错误输出:* * 生成失败**
Xcode的输出:正在写入结果包,路径:/var/文件夹/9r/ww9pfkld2rz5fggbg7tysf0c0000gn/T/Flutter工具.a2Y2jQ/Flutterios构建临时目录Ib8LW/临时扩展结果包

../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/nb_utils.dart:180:50: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
 - 'Duration' is from 'dart:core'.
      buildPageRoute(widget, pageRouteAnimation, duration),
                                                 ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/nb_utils.dart:185:50: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
 - 'Duration' is from 'dart:core'.
      buildPageRoute(widget, pageRouteAnimation, duration),
                                                 ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:67:20: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
 - 'Duration' is from 'dart:core'.
    toastDuration: duration,
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:199:20: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/scheduler/binding.dart').
  SchedulerBinding.instance!.addPostFrameCallback((_) => onCreated?.call());
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:275:29: Warning: Operand of null-aware operation '??' has type 'Duration' which excludes null.
 - 'Duration' is from 'dart:core'.
        transitionDuration: duration ?? 1000.milliseconds,
                            ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:282:29: Warning: Operand of null-aware operation '??' has type 'Duration' which excludes null.
 - 'Duration' is from 'dart:core'.
        transitionDuration: duration ?? 700.milliseconds,
                            ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:289:29: Warning: Operand of null-aware operation '??' has type 'Duration' which excludes null.
 - 'Duration' is from 'dart:core'.
        transitionDuration: duration ?? 700.milliseconds,
                            ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:299:29: Warning: Operand of null-aware operation '??' has type 'Duration' which excludes null.
 - 'Duration' is from 'dart:core'.
        transitionDuration: duration ?? 500.milliseconds,
                            ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/common.dart:309:29: Warning: Operand of null-aware operation '??' has type 'Duration' which excludes null.
 - 'Duration' is from 'dart:core'.
        transitionDuration: duration ?? 500.milliseconds,
                            ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/extensions/widget_extensions.dart:267:51: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
 - 'Duration' is from 'dart:core'.
        buildPageRoute(this!, pageRouteAnimation, duration),
                                                  ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/extensions/widget_extensions.dart:272:51: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
 - 'Duration' is from 'dart:core'.
        buildPageRoute(this!, pageRouteAnimation, duration),
                                                  ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/utils/after_layout.dart:11:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/widgets/OverlayCustomWidget.dart:59:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
      WidgetsBinding.instance!.addPostFrameCallback((_) => showOverlay());
                     ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/widgets/OverlayCustomWidget.dart:66:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/widgets/OverlayCustomWidget.dart:73:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/widgets/TimerWidget.dart:41:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.addObserver(this);
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.4.12/lib/src/widgets/TimerWidget.dart:56:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.removeObserver(this);
                   ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_datetime_picker-1.5.1/lib/flutter_datetime_picker.dart:311:32: Warning: Operand of null-aware operation '??' has type 'Color' which excludes null.
 - 'Color' is from 'dart:ui'.
                  color: theme.backgroundColor ?? Colors.white,
                               ^
Failed to package /Users/ryannapolitano/Desktop/Skape/ios/...
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Libuv-gRPC' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
note: Run script build phase '[CP] Copy Pods Resources' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')

Result bundle written to path:
    /var/folders/9r/ww9pfkld2rz5fggbg7tysf0c0000gn/T/flutter_tools.a2Y2jQ/flutter_ios_build_temp_diriIb8LW/temporary_xcresult_bundle

无法为模拟器构建应用程序。在iPhone 14 Pro Max上启动应用程序时出错。

    • Flutter医生输出**

[] Flutter(频道稳定,3.0.5,在macOS 13.0.1 22A400 darwin-x64上,语言环境en-US)·Flutter版本3.0.5位于/用户/ryannapolitano/开发者/flutter·上游库https://github.com/flutter/flutter.git·框架修订版f1875d570e(6个月前),2022年7月13日11:24:16 - 0700·引擎修订版e85ea0e79c·Dart版本2.17.6·DevTools版本2.12.2
[] Android工具链-为Android设备开发(Android SDK版本33.0.1)·Android SDK位于/Users/ryannapolitano/Library/Android/sdk·平台android-33-ext4,构建工具33.0.1·Java二进制位于:/应用程序/Android www.example.com·Java版本OpenJDK运行时环境(内部版本11.0.13 + 0-b1751.21 - 8125866)·接受所有Android许可证。Studio.app/Contents/jre/Contents/Home/bin/java · Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) · All Android licenses accepted.
[] Xcode-为iOS和macOS开发(Xcode 14.2)·Xcode位于/应用程序/www.example.com·CocoaPods版本1.11.3Xcode.app/Contents/Developer · CocoaPods version 1.11.3
[] Chrome浏览器-为网络开发·Chrome浏览器位于/Applications/Google www.example.com Chrome浏览器Chrome.app/Contents/MacOS/Google Chrome
[] Android工作室(版本2021.3)·Android工作室在/应用程序/Android www.example.com·Flutter插件可以安装从:Studio.app/Contents·Java版本的OpenJDK运行时环境(内部版本号11.0.13 + 0-b1751.21 - 8125866)🔨 https://plugins.jetbrains.com/plugin/9212-flutter · Dart plugin can be installed from:🔨 https://plugins.jetbrains.com/plugin/6351-dart · Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[]互联设备(3款可用)·iPhone 14 Pro Max(手机)·A53BC5BD-D103 - 44D5-BC9A-E1CA0ECFDD15·ios·com·苹果·酷睿模拟器·模拟运行时·iOS-16 - 2(模拟器)·macOS(桌面版)·macos·达尔文-x64·macOS 13.0.1 22A400达尔文-x64·Chrome(网页版)·Chrome浏览器·网页JavaScript·谷歌Chrome浏览器109.0.5414.87
[] HTTP主机可用性·所有必需的HTTP主机都可用
未发现问题!

    • Flutter版本**

Flutter3.0.5·通道稳定·https://github.com/flutter/flutter.git框架·修订版f1875d570e(6个月前)·2022 - 07 - 13 11:24:16 -0700引擎·修订版e85ea0e79c工具·Dart 2.17.6·开发工具2.12.2

    • XCODE版本**

版本14.2(14C18)

    • PODFILE**
platform :ios, '12.0'

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!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
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['ENABLE_BITCODE'] = 'NO'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    end
  end
end
ccgok5k5

ccgok5k51#

我也有同样的问题,在删除了项目中的每个包并测试了每个包之后,我使用了pub包nb_utils(版本5. 0. 5)安装导致了这个问题,删除包修复了它,但问题是我需要这个包在我的项目中的一些功能,我的应用程序的工作,所以我耐心地等待他们的开发人员把他们的软件包带到新的Flutter/Dart版本上

相关问题