Onesignal-flutter-sdk: Flutter.framework/Flutter' does not contain bitcode

Created on 5 Oct 2019  ·  15Comments  ·  Source: OneSignal/OneSignal-Flutter-SDK

Hi,
I am getting the following issue after adding OneSignal SDK.

'/Users/vivekdubey/Documents/flutter/bin/cache/artifacts/engine/ios-release/
    Flutter.framework/Flutter' does not contain bitcode. You must rebuild it
    with bitcode enabled (Xcode setting ENABLE_BITCODE), o'btain an updated
    library from the vendor, or disable bitcode for this target. file
    '/Users/vivekdubey/Documents/flutter/bin/cache/artifacts/engine/ios-release/
    Flutter.framework/Flutter' for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see
    invocation)
    note: Using new build systemnote: Planning buildnote: Constructing build
    description

As per the previous threads here 'Enable Bitcode'is set to 'No' for Runner project, however I do not find same setting for 'OneSignalNotificationServiceExtension'.

I also see that in Pod file this is set to no for all.

Below is the POD file:

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

# 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 pub 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
  use_frameworks!
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

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

The code runs from command line but does not creates a build, neither from Xcode.
Did I missed anything ?

Help Wanted

Most helpful comment

@vivdub did you open all settings?
Снимок экрана 2019-10-11 в 11 53 46
Here 'Enable bitcode' you must change to 'No'

All 15 comments

I'm having the same issue tryin to build the iOS version.

Will try this.

HI,
I tried but I am not sure what to add, for now my project mainly contains a webview plugin and IOS notifications.
Here are the things I added.

flutter_webview_plugin.framework
onesignal_flutter_framework
Pods_OneSignalNotificationServiceExtension.framework
Pods_Runner.framework
UserNotifications.framework

@vivdub did you open all settings?
Снимок экрана 2019-10-11 в 11 53 46
Here 'Enable bitcode' you must change to 'No'

Yes I did that, this was the solution suggested in few threads, but it did not worked.
If there is something else that needed to be done after disabling then I am not sure, I disabled, then cleaned the build folder and rebuilt again.

Oh one more thing, I was seeing this build option inside Runner, but it was not there in OneSignal, when I added a custom variable, it said it is already there.
May be this is the issue, any comments on this ?
Also in the pod file, I think it is set to NO for all.

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

This is not a OneSignal issue. Please contact our suppor channel at OneSignal.com if you are looking for OneSignal-related help. Cheers

Where exactly on OneSignal.com ?

There is a chat bubble in the bottom right

ok Thanks

Go to Xcode:

Project -> Building Settings -> Enable Bitcode Set to 'NO'

For me it was set to YES for some reason.

HI,
It was already No for me.
Thanks

Oh one more thing, I was seeing this build option inside Runner, but it was not there in OneSignal, when I added a custom variable, it said it is already there.
May be this is the issue, any comments on this ?
Also in the pod file, I think it is set to NO for all.

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

Thanks a lot, it works for me!
I use Flutter develop one app, it have to use a Flutter plugin , and the plugin import a ios .framework, aways report this error: "does not contain bitcode" when i build project.
But i had set Xcode settings correct, after try long time, i use method above in my Flutter/ios/Podfile. Then fix it.
Thanks again!

Oh one more thing, I was seeing this build option inside Runner, but it was not there in OneSignal, when I added a custom variable, it said it is already there.
May be this is the issue, any comments on this ?
Also in the pod file, I think it is set to NO for all.

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

Thanks a lot, it works for me!
I use Flutter develop one app, it have to use a Flutter plugin , and the plugin import a ios .framework, aways report this error: "does not contain bitcode" when i build project.
But i had set Xcode settings correct, after try long time, i use method above in my Flutter/ios/Podfile. Then fix it.
Thanks again!

Was this page helpful?
0 / 5 - 0 ratings