无法在获取CFBundleIdentifier的iOS上运行Flutter应用程序

时间:2019-03-06 05:37:28

标签: ios flutter

我是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的评论,但都无效。所以,我有点迷茫。 顺便说一句,吊舱安装正常。有时我只会得到CFBundleIdentifier) does not exist,但确实如此

1 个答案:

答案 0 :(得分:1)

您应该在颤动日志中看到类似的消息: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>