Exposing flutter module as IOS framework results in "Failed to find assets path for "Frameworks/App.framework/flutter_assets" - ios

I am receiving Failed to find assets path for "Frameworks/App.framework/flutter_assets when trying to expose a Flutter project via a framework to another IOS project (Add to App via a Framework).
I created a Flutter project that i now want to expose as a native Framework for IOS. We want to share our project with other companies so that they can integrate it in their IOS application.
I followed the documentation described on https://flutter.dev/docs/development/add-to-app/ios/project-setup and i used option C. This will create an XCFramework of our Flutter module and integrate it in our native IOS Framework which will have an API to work with the flutter project. In that way our IOS Framework can be seen as an Umbrella kind of Framework but also with an exposed API.
So what i created is:
A Flutter module
An IOS Framework
An IOS Project
I build the flutter module using ./flutterw build ios-framework --cocoapods --xcframework --no-universal --output=../WhiteLabelIOSFrameWork/Flutter --verbose into the IOS Framework. I added the libraries to the Framework and i created a codespec file for the Framework with only Flutter as a dependency. Afterwards i added a Podfile to the project and added the Framework as a dependency.
All of this is working (i only needed to upgrade to Flutter 1.24.X to have this fix available https://github.com/flutter/flutter/pull/69736). But when i start my Flutter engine it's unable to find the flutter_assets (Failed to find assets path for "Frameworks/App.framework/flutter_assets).
I tried building the ios-framework directly into our IOS project and skip the in between Framework and then it seems to work. So i think it cannot find the flutter_assets since the App.framework is not in the IOS project itself, but in a Framework in between.
Is there a way to move the flutter_assets path or so? Or any other idea on how to solve this?
Kind regards,
Daan

This issue cause when you create Flutter Engine without FlutterDartProject.
Just add FlutterEngine(name: "your name", project: FlutterDartProject(precompiledDartBundle: Bundle.init(for: Self.self)))

Related

is there a way to create a Podfile in my flutter project using android studio?

I'm trying to add firebase to my flutter project
I'm using windows machine so I did add it to the android level app while I'm trying to add it to the IOS level app I can't find a way to create the PodFile can someone please help?
as well I don't have access to a mac right now
well I just solved the problem by navigating to the project file via CMD and to the ios file then typing pod init

What is the best practice to include third party ios sdk framework in react-native module library?

I am trying to include ios sdk framework in my react-native module library. I turned always embed swift standard library to Yes in build setting. Everything compiles fine.
Then I include the node module in an app using npm i react-native-my-framework, open sampleapp.xcworkspace and build in XCode, I get an error MyFramework/MyFramework-Swift.h not found. I tried following permutation combinations:
Put MyFramework to Frameworks, Library and Embedded Contents. and tried some other combination of build settings.
Set the framework search path in the library project - $(PROJECT_DIR)/../node_modules/react-native-my-framework/ios/
I manually included libMyFramework.a to Libraries group.
But I am still facing the same issue. What am I missing here?
Also, MyFramework is not on Cocoa pods
Update:
Now MyFramework is available on Cocoapods

React-native custom native module couldn't search header search path

I am building a wrapper SDK in react-native. However, I am new to react-native and facing following issues:
I have created a library using react-native-create-library npm package. While compiling iOS module it gives error that React-native bridge is not found.
I ignored the issue and integrated my code. When I link the SDK in a client app (created using react-native init), the SDK doesnt give the error for react-native bridge.
The existing iOS SDK is integrated via cocoapods in client app and I am trying to link it in the wrapper SDK via header search path. But whatever I try, I keep getting an error that the "module not found".
I am using Xcode 10 and Swift 5.
When I run pod install, the existing iOS SDK copies the files in Pods folder. I thought it should copy the framework file so that header search path could look up the headers in it. I have provided ${SRC_ROOT}/../../../ios/Pods as recursive in wrapper SDK's header search path. But it didn't work.
Can somebody please help me with the issues? I have googled for sample codes and suggestions but none of them worked.

How to import external iOS framework in flutter plugin?

I'm doing a flutter plugin for stream video by using RTSP protocol. I had no problem develop it for Android, but in iOS things are more complex. I have to use an external library (SGPlayer) for getting the player work. I also downloaded the demo that uses this library and seems to work. This library is NOT on Cocoapods and I need to import it directly into the plugin project from my file system. the downloaded and compiled file structure of the plugin that I would like to use looks like this:
My problem is adding the ".framework" extension file correctly to the iOS project in a way that I can use it to develop the flutter plugin (iOS part).
UPDATE:
I built the project with the framework by using instructions at this link: https://github.com/flutter/flutter/issues/17978
The problem now is that while compiling the framework it change the umbrella header because, I think, it's not using the framework module.modulemap but another one. The result is that is importing just some header and implementations, and not all.
1.Place myFramework.framework to iOS plugin folder /ios ex: myPlugin/ios
2.Update iOS plugin file: myPlugin/ios/myPlugin.podspec
Adding the below line at the bottom of the file, above 'end'
s.vendored_frameworks = 'myFramework.framework'
In Terminal : cd to myPlugin/example/ios
run command
pod install
or
pod update
Now we can find the iOS plugin code by open iOS project (example/ios/Runner.xcworkspace) in XCode and go to
#Lorenzo you can pack your plugin and make private CocoaPod or Carthage repo.
Here is a good article howtos

Installing react-native-custom-segmented control, need to install ios framework to react-native project

I'm trying to install this: https://github.com/wix/react-native-custom-segmented-control into my react-native project.
In the installation instructions, it says to move the .xcodeproj file to my project folder. I dragged it to the root folder of my project (though I am not sure that is right).
Then the instructions say to add the libCustomSegmentedControl.a file to my target's library.
The project was initialized using expo and I don't think it has a xcode target project? I am confused as to how to proceed in installing this. Is there a secret place in a react-native app that I can find the xcode project?
I'm a beginner with ios so any help would be really appreciated!
If you created the project using expo then you need to eject it before you can install any module that expo doesn’t support.
You can find more info at this link.
https://docs.expo.io/versions/latest/expokit/eject
Expo doesn’t actually have an Xcode or Android project inside the code base, so you can’t add react-native-custom-segmented-control to an expo project.
This post does a good breakdown of the differences between creating a react-native project using expo or react-native init
https://stackoverflow.com/a/49324689/5508175

Resources