-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
I'm working on a dart/flutter plugin (object database) which has a dependency on a native dynamic library. I can get it working fine if I copy the "ObjectBox.framework" in the plugin ios folder but if I use "http" source in the podspec, the linking fails. I'm under an impression this has something to do with how flutter uses CocoaPods, or (hopefully not) with CocoaPods itself :/
You can see the changes necessary to the code here: objectbox/objectbox-dart#78 - in the end, it was mainly just the ios/objectbox.podspec and an update to the pubspec.yaml.
FYI: the podspec defines explicit compile-time linking to catch the missing framework right away during build but even when that line is removed, it'll instead fail during runtime when setting up the library using DynamicLibrary.open().
So back to the real issue I have: s.source = { :http => 'https://github.com/objectbox/objectbox-swift/releases/download/v1.1.1/ObjectBox-framework-1.1.1.zip' } doesn't work, even if I change it to non-existent URL, it doesn't seem to ever be executed.
Steps to Reproduce
- checkout the branch in the linked PR
cd example/flutter/objectbox_demoflutter pub getflutter pub run build_runner buildflutter clean && flutter run
Cleaning Xcode workspace... 2.4s
Deleting build... 38ms
Deleting .dart_tool... 0ms
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 1.5s
Running Xcode build...
├─Assembling Flutter resources... 10.1s
└─Compiling, linking and signing... 1.3s
Xcode build done. 13.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
ld: framework not found ObjectBox
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Now to get it working:
- Download
https://github.com/objectbox/objectbox-swift/releases/download/v1.1.1/ObjectBox-framework-1.1.1.zipand extract it intoobjectbox-dart/ios/, i.e. theCarthagedirectory will be alongside the objectbox.podspec - Go back to the
example/flutter/objectbox_demo flutter clean && flutter run
works fine now:
Cleaning Xcode workspace... 2.2s
Deleting build... 34ms
Deleting .dart_tool... 2ms
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 2.1s
Running Xcode build...
├─Assembling Flutter resources... 8.0s
└─Compiling, linking and signing... 14.1s
Xcode build done. 24.9s
Syncing files to device iPhone 11 Pro Max...
5,332ms (!)
🔥 To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on iPhone 11 Pro Max is available at: http://127.0.0.1:58299/F5-luj7BwPU=/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q"
Flutter doctor -v
[✓] Flutter (Channel beta, v1.11.0, on Mac OS X 10.14.6 18G1012, locale en-GB)
• Flutter version 1.11.0 at /Users/objectbox/flutter
• Framework revision 856a90e67c (3 weeks ago), 2019-11-08 18:00:01 -0800
• Engine revision af04338413
• Dart version 2.7.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.2.1, Build version 11B500
• CocoaPods version 1.8.4
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
[✓] VS Code (version 1.40.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.6.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • C4873BC5-FCE8-462E-A780-B66F1C70F96D • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)
! Doctor found issues in 2 categories.