google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.79k stars 292 forks source link

Package doesn't have bitcode enabled #159

Closed MyBuzzTechnologies closed 3 years ago

MyBuzzTechnologies commented 3 years ago

When setting Enable BITCODE = Yes in a Flutter iOS project (within Xcode), building the project fails as this package doesn't enabled bitcode.

What makes this worse is that this package is a dependency within the FlutterFire packages so adding any Firebase packages triggers this error when building.

The only solution is to keep bitcode disabled for the Flutter project, which stops us being able to add a WatchOS extension.

ykjchen commented 3 years ago

Thanks for reporting. A few questions:

  1. What dependency management system is used?
  2. Is FlutterFire being integrated as a prebuilt framework?
  3. Do you have a proposed solution?
ykjchen commented 3 years ago

I wasn't able to reproduce this using the following steps:

  1. create new flutter app,
  2. enable bitcode,
  3. add watch extension,
  4. create Firebase project, add FlutterFire plugins, and run flutter packages get (https://firebase.google.com/docs/flutter/setup),
  5. run app.

Here's a screenshot showing the state (app running, and Firebase detecting traffic):

Screen Shot 2020-09-27 at 10 06 50 AM

I have Xcode 12.0 and cocoapods 1.9.3 (I don't know if this is relevant) installed.

Is your project set up differently than this?

GenixPL commented 3 years ago

Everything is fine when you try to use it on an iOS simulator, problems arise when you try to install an app on a real iPhone or build an archive.

Error log: ld: bitcode bundle could not be generated because '/Users/genix/Library/Developer/Xcode/DerivedData/Runner-btxtvcidjpwqqagvqtlbpyewvlyw/Build/Products/Debug-iphoneos/PromisesObjC/FBLPromises.framework/FBLPromises' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/genix/Library/Developer/Xcode/DerivedData/Runner-btxtvcidjpwqqagvqtlbpyewvlyw/Build/Products/Debug-iphoneos/PromisesObjC/FBLPromises.framework/FBLPromises' for architecture arm64

GenixPL commented 3 years ago

https://github.com/flutter/flutter/issues/67285 <- repro steps

ykjchen commented 3 years ago

Thanks for the extra info. I was able to repro.

I don't see bitcode being an option in pod spec. I think the consumer is meant to control enablement. Two options:

  1. Manually enable (note that you'll have to manually enable bitcode for all targets, and not just PromisesObjc... I think PromisesObjc just happens to be the first failure here):

    Screen Shot 2020-10-05 at 12 19 04 AM
  2. Add a post_install script to your Podfile that enables bitcode for all targets (the inverse of this):

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

Option 2 is probably more maintainable. This worked for me, so I'll go ahead and close this. Please reopen if it doesn't help. Thanks!