Flutter构建IOS位码问题,如何修复位码错误

9
我尝试在连接手机的情况下构建iOS或者运行"flutter build ios"命令时,出现了以下错误:
ld: '/Users/Library/Developer/Xcode/DerivedData/Runner-dwvxvkkosgpgqncynmszqlholtde/Build/Products/Debug-iphoneos/BoringSSL-GRPC/libBoringSSL-GRPC.a(BoringSSL-GRPC-dummy.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/Library/Developer/Xcode/DerivedData/Runner-dwvxvkkosgpgqncynmszqlholtde/Build/Products/Debug-iphoneos/BoringSSL-GRPC/libBoringSSL-GRPC.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

如果我使用模拟器运行,它能够正常工作,但是当连接实体设备或者进行Flutter构建时就出现了问题,如何解决?

doctor -v

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en)
    • Flutter version 1.12.13+hotfix.5 at /Users/user/Development/flutter
    • Framework revision 27321ebbad (4 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/User/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.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_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • RIFAL’s iPhone • 8c498b6246bf8191b049a9253b87ff2604b85671 • ios • iOS 13.3

• No issues found!
1个回答

11
安装一个依赖于位码的库后,我也遇到了类似的问题。请像图片中一样,在项目“Pods”所有目标中更改启用位码

enter image description here


2
这个对我有用。我认为这应该是被接受的答案。 - filiph
1
每次我想要构建时都必须这样做。一定有更好的方法来做这件事并让它记住。有什么想法吗? - Drew Bartlett
首先,如果您使用的库默认启用了位码,则无需一次又一次地设置它,这样会很方便。是的,这很令人沮丧,但Flutter目前不支持位码,所以我找到的唯一更好的方法是避免使用需要位码的库。我在项目中删除了需要位码的扩展名,并使用了自己的实现,这样我就不必再经历这些麻烦了。这是我找到的更好的方法。 - Alish Giri
将启用的位码从YES更改为NO解决了我的问题。 - sanyam jain

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接