Steps to reproduce
-
Create a Flutter module intended to be used as a framework inside a native iOS app:
flutter create -t module repro_module
-
Build Flutter iOS frameworks (not a full Flutter app):
flutter build ios-framework
-
Integrate the generated Flutter frameworks into a native UIKit iOS application using CocoaPods (Flutter Add-to-App / frameworks approach).
-
In the Flutter module, update pubspec.yaml:
dependencies:
flutter:
sdk: flutter
path_provider: ^2.1.5
-
Run:
flutter pub get
flutter build ios-framework
- Launch the native iOS app that embeds the Flutter framework.
- Call any API that uses path_provider, for example:
getApplicationDocumentsDirectory();
Expected results
- The native iOS app launches successfully.
- The embedded Flutter framework initializes correctly.
- getApplicationDocumentsDirectory() returns a valid directory.
- Flutter framework behavior is identical to pre-FFI versions of path_provider_foundation.
Actual results
The native iOS app crashes at runtime when the embedded Flutter framework initializes:
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Couldn't resolve native function 'DOBJC_initializeApi' in 'package:objective_c/objective_c.dylib' : Failed to load dynamic library 'objective_c.framework/objective_c': Failed to load dynamic library 'objective_c.framework/objective_c': dlopen(objective_c.framework/objective_c, 0x0001): tried: '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRootobjective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/objective_c.framework/objective_c' (no such file), '/usr/lib/swift/objective_c.framework/objective_c' (no such file, not in dyld cache), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/Frameworks/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/Frameworks/objective_c.framework/objective_c' (no such file), '/usr/lib/objective_c.framework/objective_c' (no such file, not in dyld cache), 'objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/objective_c.framework/objective_c' (no such file).
#0 Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart)
#1 Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1943:20)
#2 initializeApi (package:objective_c/src/c_bindings_generated.dart)
#3 _ensureDartAPI (package:objective_c/src/internal.dart:212:22)
#4 _newFinalizableHandle (package:objective_c/src/internal.dart:221:3)
#5 new _ObjCReference (package:objective_c/src/internal.dart:242:14)
#6 new ObjCObjectRef (package:objective_c/src/internal.dart:322:7)
#7 new ObjCObject (package:objective_c/src/internal.dart:334:13)
#8 NSArray.fromPointer (package:objective_c/src/objective_c_bindings_generated.dart:1379:23)
#9 FoundationFFI.NSSearchPathForDirectoriesInDomains (package:path_provider_foundation/src/ffi_bindings.g.dart:29:25)
#10 PathProviderFoundation._getUserDirectory (package:path_provider_foundation/src/path_provider_foundation_real.dart:146:35)
#11 PathProviderFoundation._getDirectoryPath (package:path_provider_foundation/src/path_provider_foundation_real.dart:122:22)
#12 PathProviderFoundation.getApplicationDocumentsPath (package:path_provider_foundation/src/path_provider_foundation_real.dart:64:12)
#13 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:40)
#14 commonInitialization (package:ivestor/main.dart:86:38)
#15 ivestor (package:ivestor/main.dart:63:9)
#16 _runMain.<anonymous closure> (dart:ui/hooks.dart:345:23)
#17 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:314:19)
#18 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)
This crash happens inside the Flutter framework before any Dart main() code executes, making it impossible to work around in application code.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await getApplicationDocumentsDirectory();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(child: Text('Repro')),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Couldn't resolve native function 'DOBJC_initializeApi' in 'package:objective_c/objective_c.dylib' : Failed to load dynamic library 'objective_c.framework/objective_c': Failed to load dynamic library 'objective_c.framework/objective_c': dlopen(objective_c.framework/objective_c, 0x0001): tried: '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRootobjective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/Xcode/DerivedData/iVESTOR-chzjnchpswubwsbxupsgnfvywqtc/Build/Products/Debug-iphonesimulator/PackageFrameworks/objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/objective_c.framework/objective_c' (no such file), '/usr/lib/swift/objective_c.framework/objective_c' (no such file, not in dyld cache), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/Frameworks/objective_c.framework/objective_c' (no such file), '/Users/kishanraja/Library/Developer/CoreSimulator/Devices/C601F808-A156-44A6-B2D8-AC4493D96C0A/data/Containers/Bundle/Application/F715F741-2D68-43CA-8F4D-B86370DB1854/iVESTOR-UAT.app/Frameworks/objective_c.framework/objective_c' (no such file), '/usr/lib/objective_c.framework/objective_c' (no such file, not in dyld cache), 'objective_c.framework/objective_c' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23A343/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/objective_c.framework/objective_c' (no such file).
#0 Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart)
#1 Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1943:20)
#2 initializeApi (package:objective_c/src/c_bindings_generated.dart)
#3 _ensureDartAPI (package:objective_c/src/internal.dart:212:22)
#4 _newFinalizableHandle (package:objective_c/src/internal.dart:221:3)
#5 new _ObjCReference (package:objective_c/src/internal.dart:242:14)
#6 new ObjCObjectRef (package:objective_c/src/internal.dart:322:7)
#7 new ObjCObject (package:objective_c/src/internal.dart:334:13)
#8 NSArray.fromPointer (package:objective_c/src/objective_c_bindings_generated.dart:1379:23)
#9 FoundationFFI.NSSearchPathForDirectoriesInDomains (package:path_provider_foundation/src/ffi_bindings.g.dart:29:25)
#10 PathProviderFoundation._getUserDirectory (package:path_provider_foundation/src/path_provider_foundation_real.dart:146:35)
#11 PathProviderFoundation._getDirectoryPath (package:path_provider_foundation/src/path_provider_foundation_real.dart:122:22)
#12 PathProviderFoundation.getApplicationDocumentsPath (package:path_provider_foundation/src/path_provider_foundation_real.dart:64:12)
#13 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:40)
#14 commonInitialization (package:ivestor/main.dart:86:38)
#15 ivestor (package:ivestor/main.dart:63:9)
#16 _runMain.<anonymous closure> (dart:ui/hooks.dart:345:23)
#17 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:314:19)
#18 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)]
Unhandled Exception: Invalid argument(s):
Couldn't resolve native function 'DOBJC_initializeApi'
in 'package:objective_c/objective_c.dylib'
Failed to load dynamic library 'objective_c.framework/objective_c'
(no such file)
Flutter Doctor output
Doctor output
doctor --verbose
[✓] Flutter (Channel stable, 3.38.7, on macOS 26.0 25A353 darwin-arm64, locale en-IN) [1,461ms]
• Flutter version 3.38.7 on channel stable at /Users/kishanraja/Desktop/Soft./flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3b62efc2a3 (10 days ago), 2026-01-13 13:47:42 -0800
• Engine revision 78fc3012e4
• Dart version 3.10.7
• DevTools version 2.51.1
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [2.6s]
• Android SDK at /Users/kishanraja/Library/Android/sdk
• Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
• Platform android-36.1, build-tools 36.1.0
• ANDROID_HOME = /Users/kishanraja/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/kishanraja/Library/Android/sdk
• Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.0) [1,723ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17A324
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [6ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (2 available) [6.4s]
• macOS (desktop) • macos • darwin-arm64 • macOS 26.0 25A353 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 144.0.7559.60
! Error: Browsing on the local area network for Raja’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone XR. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for anshul’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for Anshul’s Apple Watch. Ensure the device is unlocked and discoverable via Bluetooth. (code -27)
[✓] Network resources [418ms]
• All expected network resources are available.
• No issues found!
Regression information
Works when pinning:
dependency_overrides:
path_provider_foundation: 2.5.1
Crashes with:
path_provider_foundation 2.6.0
objective_c 9.2.4
Recent related releases
path_provider_foundation 2.6.0 (released ~8 hours ago):
Re-release: replaces Flutter-plugin-based implementation with direct FFI calls to Foundation.
objective_c 9.2.4 (released ~8 hours ago):
Fix build hook path issue that could pass percent-encoded cache paths to clang.
This suggests the new direct FFI implementation is incompatible with Flutter frameworks embedded in native iOS apps.
Steps to reproduce
Create a Flutter module intended to be used as a framework inside a native iOS app:
flutter create -t module repro_moduleBuild Flutter iOS frameworks (not a full Flutter app):
flutter build ios-frameworkIntegrate the generated Flutter frameworks into a native UIKit iOS application using CocoaPods (Flutter Add-to-App / frameworks approach).
In the Flutter module, update pubspec.yaml:
dependencies:
flutter:
sdk: flutter
path_provider: ^2.1.5
Run:
getApplicationDocumentsDirectory();Expected results
Actual results
The native iOS app crashes at runtime when the embedded Flutter framework initializes:
This crash happens inside the Flutter framework before any Dart main() code executes, making it impossible to work around in application code.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
Flutter Doctor output
Doctor output
Regression information
Works when pinning:
Crashes with:
Recent related releases
path_provider_foundation 2.6.0 (released ~8 hours ago):
objective_c 9.2.4 (released ~8 hours ago):
This suggests the new direct FFI implementation is incompatible with Flutter frameworks embedded in native iOS apps.