我是新手,想在iOS上实现我的第一个应用程序,但是,自上周以来,我正面临着这个问题,并试图解决它。
1。运行“ flutter build ios”后,构建和签名成功
2。项目存档也很成功
(问题) 但是,当我单击验证应用程序时。我收到以下问题,我花了很多时间并进行了很多调试,但找不到导致此问题的原因。
终端输出:Flutter Doctor -v
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale en-GB)
• Flutter version 1.22.3 at /Users/sohumwahi/Library/flutter
• Framework revision 8874f21 (6 days ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/sohumwahi/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.50.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • 093FA4C3-39F3-4D69-B945-DDD155FDBD49 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
! Doctor found issues in 1 category.
答案 0 :(得分:1)
以下是解决此错误的方法: 您必须在xcode中添加脚本,以删除第3方库的未使用代码。 当您使用xcode打开flutter iOS项目时,您会在构建阶段部分看到flutter已经有一个脚本。不要弄乱这个脚本,相反,您将添加一个新脚本。 这张图片如下:
然后您将看到类似这样的内容:
在此之后,打开运行脚本并放置以下代码:
# Type a script or drag a script file from your workspace to insert its path.APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name 'FRAMEWORK_NAME*.framework' -type d | while read -r
FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o
"$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create
"${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
如果遇到错误指出脚本中存在语法错误,请尝试删除在尝试复制脚本时可能已复制的无法识别的字符 因为xcode不会处理它们,所以它发生在我身上。因此,将代码复制并放置在能够处理此类字符的其他代码编辑器中(例如,Visual Studio),然后从某些行的末尾删除不需要的字符。 所以现在总共有两个脚本在运行
答案 1 :(得分:1)
经过大量搜索和尝试,我发现我在配置中出错,解决了此问题后,我设法验证了该应用并将其成功上传到App Store。