How to embed local .xcframework to Flutter IOS plugin? - ios

I'm totally new in IOS development, so I only have basic knowledge on how Pod/Podspec, but I don't really know how it works
Basically I have this flutter plugin project that uses external dependency in .aar(android) and .xcframework(iOS). I wanted to embed this .xcframework into my plugin, so I imported the file into my ios plugin directory, and add it in the Framework & Library in xcode.
But when I use the plugin in my app flutter project, the library in .xcframework is not recognized, unless I do the same thing again, which is importing the .xcframework file, and add it to Framework & Library in xcode...
I tried to set the Embed options to Embed & Sign and Embed without Signing, does not work!
Can I just embed the .xcframework in the plugin, so other project can simply add the plugin in the pubspec and works, just like .aar in Android library? Thank you

Related

How to add a framework to iOS library project?

I have very little experience in native iOS development but my current job is to wrap some specific native iOS framework to use it in React Native.
Preliminary data: common React Native tools generate an empty iOS library project and an example iOS app project that utilizes this library.
First I've tried to add the needed framework directly to the example app using CocoaPods - and it works fine, the framework became a part of linked libPods.a file, then if I add
#import MyTargetFramework;
to AppDelegate.m I can access different methods of the framework from it.
Next I switched to my iOS library project, applied the same setup (created a Podfile, added the same pod MyTargetFramework to it), then added the same #import MyTargetFramework to *.m file - but got a build error:
Module 'MyTargetFramework' not found
Also I've noticed that there is no libPods.a for iOS library project, all the pods are merged to a Pods.framework instead.
So my question is - what am I doing wrong? Why does it work for iOS app project, but not for iOS library project? How can I properly link my target framework to my own iOS library? I've already spent some time googling, but found nothing about app vs lib differences from this point.

How to enable "always embed swift standard libraries" for a xamrin app?

I have a xamarin forms app, in which I am using a binding dll generated for a swift framework.
But as per apple doc,
If you are building an app that does not use Swift but embeds content such as a framework that does, Xcode will not include these libraries in your app. To workaround this issue, set the Embedded Content Contains Swift Code (EMBEDDED_CONTENT_CONTAINS_SWIFT) build setting to YES in your app. This build setting, which specifies whether a target's product has embedded content with Swift code, tells Xcode to embed Swift standard libraries in your app when set to YES.
So how can we enable this build setting for a xamarin app ?
[Edit]
SwiftRuntimeSupport NuGet package is already part of the project. But still, on checking the ipa, it was found that the swiftSupport folder includes only an empty iphoneos folder.
Xamarin has a SwiftRuntimeSupport nuget that handles the iOS version and build details.
Use the SwiftRuntimeSupport NuGet package to automatically include required dylib dependencies into the resulting application package.
Consume the Xamarin binding library
Blog Post: Binding iOS Swift Libraries
Recently, I got an error with using Swift libraries and I tried #SushiHangover's solution. While the library itself did not solve the problem, it had these instructions in the Readme file for uploading the Archive using XCode instead of Visual Studio, which solved my problem:
In Visual Studio, select a valid iOS device before archiving.
Go to Build menu / Archive for Publishing
Once done, open Xcode and go to Window / Organizer
Select the Archives tab
On the left side of the window, select your app
Click on Distribute App button and follow the wizard

Integrate Firebase Crashlytics (beta) SDK in iOS project without PODS

I am integrating FrirebaseCrashlytics SDK in tvOS and iOS without cocopods. I downloaded their xcFramework. But I can't use the xcFramework as the project is not compatible so I drag and drop ios-armv7_arm64 framework to project and added Firebase.h and module.modulemap (my project uses both objc and swift). Also, I specified the Firebase.h in the bridging header. I get below error when I build.
Showing Recent Errors Only
/Users/xxxxx/Code/ios/tvOSApplications/App/App/Firebase.h:15:9: 'FirebaseCore/FirebaseCore.h' file not found
Showing Recent Errors Only
/Users/xxxxx/Code/ios/tvOSApplications/App/App/App-tvOS-Bridging-Header.h:27:9: Could not build module 'Firebase'
Multiple problems to address (based on instructions in the README at the base of the distribution:
The zip distribution requires Xcode 11 which supports xcframeworks
The zip distribution only supports iOS. tvOS is only distributed via CocoaPods
All Firebase installations require the xcframeworks in the Analytics folder to also be installed.
I am able to get firebasecrashlytic .framework files without cocopods using Carthage. I copied files to project and it works in iOS project. I am looking for a similar solution for tvOS
Recently I had a similar requirement of supporting Firebase on both iOS and tvOS. As the frameworks are available only on iOS and not on tvOS. I could not integrate Frameworks. So the solution I followed is adding of Source files provided in https://github.com/firebase/firebase-ios-sdk corresponding to the required modules that are needed for enabling Firebase Crashlytics.
This solution worked for me and able to see the crashes. Let me know if you need more information
I got Firebase Crashlytics working for tvOS without Cocoapods or XCFramework bundles. Basically, you just need to bring over the source files, set the header search paths, and set all the required preprocessor macros. You can read the story here.
Thanks for the hint Gangadhar!

Where is Xcode Project in React Native?

I am trying to find my Xcode project file inside React Native so I can setup React Native Firebase (https://rnfirebase.io/docs/v5.x.x/installation/ios)
However, I cannot find where the Xcode project file is? Can anyone help.
You can find Xcode project files here:
yourProjectDir/ios/yourprojectname.xcodeproj
If You use cocoapods then you should always use this file:
yourProjectDir/ios/yourprojectname.xcworkspace
If you use Expo or create react native app you will not have an iOS folder as these are abstracted away from you.
If you wish to use a dependency that requires you to edit native code then you need to eject your application. https://docs.expo.io/versions/latest/expokit/eject
From your command line run expo eject and it will build the necessary ios and android folders for you. However there are several ramifications if you eject your app. You should read the above link carefully.
YourRNProject/ios and there you have it inside!
Open your react native folder
you can see ios folder
this folder is what you search for

How to add FirebaseUI-iOS to an ios project without using CocoaPods?

I am creating an iOS app in which I would like to use FirebaseUI-iOS.
I am currently using Carthage to manage the dependencies.
FirebaseUI-ios does not currently support carthage (issue)
The following information is provided in the README of the FirebaseUI-iOS project.
Otherwise, you can download the latest version of the FirebaseUI frameworks from the releases
page or include the FirebaseUI
Xcode project from this repo in your project. You also need to add the Firebase
framework to your project.
However, I do not know exactly how to add the FirebaseUI project after downloading the release file.
Can someone point out how I can add the FirebaseUI-iOS framework to an iOS project without using CocoaPods?

Resources