Flutter iOS 打包等采坑ing...

2020-02-26  本文已影响0人  lym不解释

flutter打包报错记录:

iOS13苹果取消了32位系统的支持,
而SDK包含i386 x86_64的架构,
日志IDEDistribution.standard.log

处理方法:
在程序里加一个脚本,剔除禁止的架构
TARGETS->Build Phases->New Run Script Phase
脚本内容在Flutter官方issuse里面:
https://github.com/flutter/flutter/issues/42917

flutter build ios --release

看到错误信息中有Signing iOS app 并不是当前发布的app账号,

  1. 删除keys中所有其他的账号证书,只保留发布账号,
  2. .ios/runner工程中使用发布账号,修改了bundle id, 但是这个好像没有什么用,重新编译flutter的时候也会改为默认。
  3. 根据issue修改
    https://github.com/flutter/flutter/issues/18305
    https://github.com/flutter/flutter/issues/24376
1.  open ios/Runner.xcodeproj
2.  I checked Runner/Pods is empty in Xcode sidebar.
3.  drop Pods/Pods.xcodeproj into Runner/Pods.
4.  "Valid architectures" to only "arm64" (I removed armv7 armv7s) 
[13364](https://github.com/flutter/flutter/issues/13364)
5. 只支持iOS平台,并设置只支持64位,Build Settings - Architectures - Supported Platforms = ios Valid Acrchitectures = arm64
6. 将New Build System(Default)切换成Legacy build system。第一个错误设置有详细操作

错误信息:

Encountered error while building for device.

或者

error: Building for iOS, but the embedded framework 'App.framework' was built for macOS. (in target 'Runner' from project 'Runner')
Encountered error while building for device.
// 清理的时候,如果是插件工程,一定要cd到主flutter工程和example工程 一起clean
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec

1- rm -rf ios/Flutter/App.framework

2- Change the Runner target build settings Build Phases > Thin Binary script as follows:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin
系统偏好设置>网络> iPhone USB>取消选中“除非需要,否则禁用”>应用。

如果没有iPhone USB,则可能需要打开热点才能使其显示,以便取消选中该设置。
该设置在启用或不启用热点的情况下都适用,启用时将导致mDNS查找失败。
<key>CFBundleDisplayName</key>
<string>显示的app名字</string>

<key>CFBundleName</key>
上一篇下一篇

猜你喜欢

热点阅读