question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build Failed Xcode

See original GitHub issue

VSC is unable to build to run on iOS emulator The following error is returned

Launching lib/main.dart on iPhone 8 Plus in debug mode...
Xcode build done.                                           12.5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/xxxx/SDK/crossplatform/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_email_sender-1.0.1/ios/Classes/FlutterEmailSenderPlugin.m:2:9: fatal error: 'flutter_email_sender/flutter_email_sender-Swift.h' file not found
#import <flutter_email_sender/flutter_email_sender-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.

I made changes to my podfile in order to get OneSignal notifications to work

# Uncomment this line to define a global platform for your project
platform :ios, '10.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
  # 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

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.5', '< 3.0'
end

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
lingstercommented, Aug 19, 2019

Thanks @ricardolopezmobiledev your solution worked for me: rm -rf ios flutter create -i swift .

3reactions
RicardoLugoSoftwarecommented, Aug 13, 2019

Now it works! I was stuck with this for a couple of hours and the truth is quite simple to fix,

1- in your flutter project go completely delete the “ios” folder 2. Open terminal and within your flutter project folder execute the command “flutter create -i swift.” 3. Compile the project normally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode: Build Failed, but no error messages - Stack Overflow
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons. One possible cause is if there ...
Read more >
Build Failed — but no reason! | Apple Developer Forums
Hi, I'm experiencing weird Xcode behavior. I'm getting "build failed" after some alterations to the code, but Xcode will NOT give me the...
Read more >
Oh dear! Build errors? - LoopDocs - GitHub Pages
Open your Loop project again in Xcode . In the main Xcode menu (grey menu bar at the very top of your Apple...
Read more >
Xcode 7.1 Build failed with cocoapods : TW-44040
Xcode 7.1 Build failed with cocoapods · 1) Check in generated .xcworkspace and Podfile.lock files to version control · 2) Change the target...
Read more >
xcode build fail in Xcode 14 · Issue #20701 · fastlane ... - GitHub
Xcode command line tool xcodebuild fails, most likely because of these errors. Although it does produce the .xcarchive file. This looks like an ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found