5

I wrote an app in Flutter, and I am looking to add a native iOS today extension to it. I added the widget target but when I try to build the build fails because the app extension target can not find specific flutter libraries (which does not make sense since it wouldn't use them anyway).

From what I can gather, the xCode project is trying to include Flutter libraries with all targets?

Here is the error:

ld: warning: directory not found for option '-F/Users/nickmowen/Library/Developer/Xcode/DerivedData/Runner-egikkgpuyfdkbcconodjborapzme/Build/Products/Debug-iphoneos/share'
ld: warning: directory not found for option '-F/Users/nickmowen/Library/Developer/Xcode/DerivedData/Runner-egikkgpuyfdkbcconodjborapzme/Build/Products/Debug-iphoneos/shared_preferences'
ld: warning: directory not found for option '-F/Users/nickmowen/Library/Developer/Xcode/DerivedData/Runner-egikkgpuyfdkbcconodjborapzme/Build/Products/Debug-iphoneos/sqflite'
ld: warning: directory not found for option '-F/Users/nickmowen/Library/Developer/Xcode/DerivedData/Runner-egikkgpuyfdkbcconodjborapzme/Build/Products/Debug-iphoneos/url_launcher'
ld: framework not found FMDB
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas to fix this? Thanks!

Edit:

Going into Pods and enabling bitcode for each of the flutter libraries in there got rid of a bunch of errors, but then I am getting this error:

ld: '/Users/nickmowen/Library/Android/flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Flutter' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/nickmowen/Library/Android/flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Flutter' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Nick Mowen
  • 2,572
  • 2
  • 22
  • 38

2 Answers2

5

This works for me.

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

Image

HYD
  • 75
  • 6
0

After fresh added Today Extension, no need to enable bitcode, just overwrite setting in Target: Today Extension:

  • LIBRARY_SEARCH_PATHS = "";
  • OTHER_LDFLAGS = ""; or OTHER_LDFLAGS = "-ObjC";

Maybe need clear DerivedData

JerryZhou
  • 4,566
  • 3
  • 37
  • 60