ios - flutter/iOS : Could not determine bundle id

标签 ios xcode flutter dart flutter-ios

在我的 Flutter 项目中,我尝试编译并运行我的应用程序。它在 Android 上运行良好,但出于某种原因,我现在在 iOS 上运行我的应用程序时出现以下错误:

2022-06-11 16:21:02.274 ios-deploy[42320:338779] [ !! ] [ ERROR] Could not determine bundle id.
Could not run build/ios/iphoneos/Runner.app on 00008030-001C085222DA803E.

所以这是我检查的内容:

  • Info.plist:Bundle identifier 的值为 $(PRODUCT_BUNDLE_IDENTIFIER)
  • TARGETS > Runner > Build Settings > Packaging > Product Bundle Identifier 中,我有期望值(我的包名称)
  • TARGETS > Runner > General > Bundle Identifier 中,值按预期设置(我的包名称)
  • TARGETS > Runner > Build Settings > Packaging > Info.plist File 中,我有正确的位置:Runner/Info.plist
  • 我尝试了 flutter clean、在 Android Studio 上使缓存无效并重新启动、在 Xcode 上清理构建文件夹
  • 我按照说明尝试了更多清洁 here

这是我的 Info.plist 文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>$(APP_DISPLAY_NAME)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Wezeejay</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>ENVIRONNEMENT</key>
    <string>$(ENVIRONNEMENT)</string>
    <key>LSApplicationCategoryType</key>
    <string></string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIBackgroundModes</key>
    <array>
        <string>audio</string>
        <string>remote-notification</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleLightContent</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>NSCameraUsageDescription</key>
    <string>NSCameraUsageDescription</string>
    <key>CADisableMinimumFrameDurationOnPhone</key>
    <true/>
</dict>
</plist>

但我在应用程序即将启动时仍然出现该错误,我不知道它来自哪里,因为它在两天前运行良好。

有人知道怎么解决吗?

谢谢。

最佳答案

在 xcode 中打开工作区文件。从侧面板中选择 runner 并选择 general 选项卡。您应该能够看到包 ID。在此部分添加 bundle id

preview

编辑 /用户//库/开发人员/Xcode/DerivedData

删除这个文件夹的所有内容,然后从 Xcode 转到产品,清理构建文件夹,然后再次构建

Preview

更改使用 Release 进行命令行构建以调试和构建一次。然后切换回release

关于ios - flutter/iOS : Could not determine bundle id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72585288/

相关文章:

flutter - 有没有办法控制文本小部件溢出发生的位置(多少行)?

flutter - 如何在Flutter或Dart中将字符串编码为RFC 3986?

Iphone 到 Ipad 编程和提交

ios - 重新加载表格 View 后出现抖动

ios - 从 super View iOS 中删除 View

ios - 创建一个将迭代图像数组的 UIImageView

c++ - 无法在 Xcode 上启动 SFML 应用程序

ios - swift 中的 XMPPFramework 错误

ios - 设置使用 AVAssetImageGenerator ios 生成的缩略图的图像大小

json - 从 Flutter 中的 Json 错误解析日期时间