0

如果问题的标题不够清楚,我深表歉意,这是对我所面临问题的更好解释,因此我正在尝试编写一个 shell 脚本以在应用程序中心上运行以部署我的应用程序以进行测试/生产。脚本如下

#!/usr/bin/env bash

# fail if any command fails
set -e
# debug log
set -x

cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=$(pwd)/flutter/bin:$PATH
flutter channel stable

flutter upgrade
flutter doctor
flutter clean
rm -f ios/Podfile.lock pubspec.lock
rm -rf ios/Pods ios/Runner.xcworkspace
flutter build ios --release --no-codesign

这里没什么大不了的,首先,我安装flutter然后设置它的路径,确保flutter安装正确,然后清理(只是我正在做的一件额外的事情)然后删除旧的podfile,public.lock pods和runner.xcworkspace 的原因是确保每次我想为构建生成一个全新的文件时,无论如何,运行脚本将失败并导致以下错误消息

lib/pages/reset_password_page.dart:24:62: Error: 'InputWidgetState' isn't a type.
  final GlobalKey<InputWidgetState> _phoneNumKey = GlobalKey<InputWidgetState>();
                                                             ^^^^^^^^^^^^^^^^
Failed to package /Users/muhammad/Desktop/test/OrbitFoodCustomerApp.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/muhammad/Desktop/test/OrbitFoodCustomerApp/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 15.2.99. (in target 'libPhoneNumber-iOS' from project 'Pods')

错误消息比这更长,但它是一种重复,这是最重要的部分。对我来说真正奇怪的部分是当我以以下方式修改脚本时

#!/usr/bin/env bash
#Place this script in project/ios/
# fail if any command fails
set -e
# debug log
set -x
cd ..
# git clone -b beta https://github.com/flutter/flutter.git
# export PATH=$(pwd)/flutter/bin:$PATH
flutter channel stable
flutter upgrade
flutter doctor
flutter clean
rm -f ios/Podfile.lock pubspec.lock
rm -rf ios/Pods ios/Runner.xcworkspace
flutter build ios --release --no-codesign

注意导出路径被注释掉了,所以这次脚本将使用我机器上安装的flutter,脚本成功构建了我觉得很奇怪的应用程序,我检查了两个flutter的flutter版本(新下载的和一个在我的机器上),它们完全相同。相同的分支相同的版本相同的一切。但由于某种原因,使用我自己的颤振成功,而使用下载的颤振失败。

请注意,这两个脚本都是在我自己的机器上运行的,唯一的区别是我在一个脚本中指定了颤振路径,而我在另一个脚本中使用了我之前安装的颤振,并且我确保指定了目标部署 ios版本尽可能为 12。

知道发生了什么吗?!我很困扰。先感谢您。

4

0 回答 0