首页 > 解决方案 > 无法在 iOS 上运行颤振应用程序,获取 CFBundleIdentifier 不存在

问题描述

我是 iOS 世界的新手,遇到了我不理解的问题,我遇到了以下控制台问题:

Launching lib/main.dart on iPhone XR in debug mode...
2019-03-05 23:31:46.514 defaults[19744:111480] 
The domain/default pair of (/Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Runner/Info, CFBundleIdentifier) does not exist
Xcode build done.                                           206.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    === BUILD TARGET firebase_messaging OF PROJECT Pods WITH CONFIGURATION Debug ===
    While building module 'TwitterKit' imported from /Users/josepharriaza/Desktop/jarriaza/Instaladores/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_twitter_login-1.1.0/ios/Classes/TwitterLoginPlugin.m:2:
    In file included from <module-includes>:1:
    In file included from /Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Pods/TwitterKit/iOS/TwitterKit.framework/Headers/TwitterKit.h:19:
    In file included from /Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Pods/TwitterKit/iOS/TwitterKit.framework/Headers/Twitter.h:8:
    /Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Pods/TwitterKit/iOS/TwitterKit.framework/Headers/TWTRAPIClient.h:67:12: warning: parameter 'response' not found in the function declaration [-Wdocumentation]
     *  @param response Metadata associated with the response to a URL load request.
               ^~~~~~~~
    /Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Pods/TwitterKit/iOS/TwitterKit.framework/Headers/TWTRAPIClient.h:132:12: warning: parameter 'URL' not found in the function declaration [-Wdocumentation]
     *  ...
                                                          ^
    2 warnings generated.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    error: couldn't parse contents of '/Users/josepharriaza/Desktop/Systems/tagueoflutter/ios/Runner/Info.plist': The data couldn’t be read because it isn’t in the correct format.
Could not build the application for the simulator.
Error launching application on iPhone XR.
Exited (sigterm)

这是我的 pod 文件:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  #use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

这是我的 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>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.archangelsystems.tagueo</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>tagueo</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>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <key>NSPhotoLibraryUsageDescription</key>
    <key>NSCameraUsageDescription</key>
    <string>Tagueo necesita usar la camara</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Tagueo necesita usar el microfono</string>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</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>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <!-- TODO Replace this value: -->
                <!-- Copied from GoogleServices-Info.plist key REVERSED_CLIENT_ID -->
                <string>com.googleusercontent.apps.1003547207636-vunn792g2i81bnb9cusbsiqpm9r816nh</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

我遇到的问题表明该应用程序无法在 iOS 设备上启动,我正在尝试在 iPhone XR 中启动它,正如我所提到的,我是新来的,我没有得到解决方案,我阅读了一些帖子那提到我必须评论 use_frameworks!,但这不起作用,我读了一些其他的,表明我必须取消注释 user_frameworks,但两者都不起作用。所以,我有点迷路了。顺便说一句, pod install 工作正常。有时我只得到CFBundleIdentifier) does not exist,但它确实

标签: iosflutter

解决方案


您应该在颤振日志中看到类似的消息:The domain/default pair of (../ios/Runner/Info, CFBundleIdentifier) does not exist

这个错误意味着Xcode认为你plistinvalid format content.

<key>UISupportedInterfaceOrientations</key>         //<------ here is the key
<key>NSPhotoLibraryUsageDescription</key>
<key>NSCameraUsageDescription</key>
<string>Tagueo necesita usar la camara</string>
<key>NSMicrophoneUsageDescription</key>
<string>Tagueo necesita usar el microfono</string>
<array>                                            //<------ here is the value
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>   //<------ please compare this key
<array>                                            //<------ please compare this value
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

你只需要移动keyvalue聚集

<key>UISupportedInterfaceOrientations</key>        //<------ here is the key
<array>                                            //<------ follow with the value
   <string>UIInterfaceOrientationPortrait</string>
   <string>UIInterfaceOrientationLandscapeLeft</string>
   <string>UIInterfaceOrientationLandscapeRight</string>
</array>

推荐阅读