I have an iOS Project with some third party dependencies and some of them are written in Swift. Due to that i have the flag use_frameworks! in my Podfile .
The problem occurs when I try to install AppRTC framework. AppRTC has a reference to a static library and pod install fails with the following error:
[!] The 'Pods-X' target has transitive dependencies that include static binaries: (/.../libjingle_peerconnection/libWebRTC.a)
This tutorial explains an approach to overcome this problem by placing a modified version of the podspec file for the pod where the static library resides.
https://blog.sabintsev.com/importing-c-static-libraries-into-a-swift-project-using-cocoapods-a53993c3a2ca#.fo7l8rqxi
I created a custom pospec for AppRTC and set s.vendored_libraries but I couldn't make it work.The pod dependencies of my project look like this.
If i install libjingle_peerconnection (where the static library is) and SocketRocket explicitly with cocoa pods, i do not get any error.I a only add AppRTC to my pod file i get the mentioned error.
Question 1) To which project shall i include the custom podspec?
Question 2) Do i need to install the pods separately?
|MyProject|
/ \
.... AppRTC
/ \
|SocketRocket| |libjingle_peerconnection|
Related
I'm building a Flutter Plugin for a native only available SDK . When it comes to the swift part, I've specified the pod in the .podspec file and now when I try to pod install in the Plugin's example app , I'm getting the above error . If the use_frameworks! is commented in the example app's Podfile , The error disappears but when present the error again arises.Also the same error does not come when putting the pod in the Podfile of the example app even with use_frameworks! directive. But I need to install it through the Plugin's .podspec file. I've also tried using s.static_framework=true and it works but an another error arises which is 'Include of non-modular header inside the framework module(Users/../LibraryA/LibraryA.framework/Headers/Xyz.h)' and couldn't solve this issue too.
What does the error exactly mean? Does it mean that the pod I'm trying to install is itself a static library or does it contain any static libraries as dependency?
Also why it gets installed when trying to install the pod in the Podfile with use_frameworks! but not in the .podspec file?
What are the ways through which I can fix this issue?
I am facing an error while making a flutter plugin on the iOS side while using pods. The pods are installed successfully then also I am able to import them in the file.
The pod in my case which I am trying to use is Freshchat iOS SDK
Steps I have followed to install the pod
Start a new Flutter plugin project.
In .podspec file add s.dependency 'FreshchatSDK'
Run pod install in example/ios folder.
I got an error
The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (/Users/nimish/FlutterProjects/freshchat_flutter/freshchat_flutter/example/ios/Pods/FreshchatSDK/FreshchatSDK/libFDFreshchatSDK.a)
I removed use_frameworks! from podfile following this comment .
I ran pod install again and the pods were successfully installed and Pods folder was created which had FreshchatSDK folder in it.
Now I need to have use_frameworks! in my project because other plugins are not compiling because of this.
I added s.static_framework = true in .podspec and use_frameworks! in podfile. Now pod install ran successfully,
After I added the import #import "FreshchatSDK.h" in my Plugin.h file I got the error
error: include of non-modular header inside framework module
I tried this answer but was not able to resolve it.
Please help me resolve this. I'll be respectful of your time.
There is another flutter plugin available here but it has many issues and one unhandled case is making my iOS app crash so I want to make it my own.
There may be problems in the PodFile due to unmatched Targets.
When this happens to me, I used these simple steps.
Delete Podfile
Open Terminal at the specific file
Pod init
Open Podfile and adds Dependencies
Pod install
I'm trying to understand the difference between the autolinking that exists in React Native 0.60+ and the automatic / manual linking we have in previous React Native versions.
When I add react-native-gesture-handler with npm i react-native-gesture-handler, no lines are added to my Podfile. So when I do pod install, I assume the Gesture Handler module isn't linked. However, if I link it manually as I did with previous React Native versions, by dragging the .xcodeproj files into Libraries etc, it throws an error and tells me to unlink it.
What I Want To Know:
Am I right that what autolinking does is adds a line for the given module to your Podfile, which then gets linked when you pod install? If so, why might it be that when I did npm i react-native-gesture-handler nothing was added to my Podfile? And given that nothing was added and linking the module manually throws an error, how should I link the module?
When you create a new project and react-native version >=60 , this line is automatically added in pod file (official site)
# example/ios/Podfile
require_relative '../../node_modules/#react-native-community/cli-platform-ios/native_modules'
This is path of script , so when you run "pod install" , it will check all libraries and install all pods files required
So when you add new library , no lines are added to my Podfile but you have to run "pod install" so that script file can run and install new pod files .
Please do not use manual linking as described in official site
This means that all libraries need to ship a Podspec either in the
root of their folder or where the Xcode project is. Podspec references
the native code that your library depends on.
The implementation ensures that a library is imported only once. If
you need to have a custom pod directive then include it above the
use_native_modules! function.
You have to do 2 steps
1 : Add library "yarn add react-native-gesture-handler"
2 : cd ios && pod install
I have successfully built a react-native module within a react-native int project. Now I want to extract this module (standalone i.e react-native-my-custom-module) to its own repo, so I can reuse it in other projects and open-source it. I tried using https://github.com/frostney/react-native-create-library to create this standalone react-native module. However, the react-native module has a dependency on external SDK(installed using CocoaPods i.e pod 'Firebase/Core') and due to this, I believe it is Breaking.
What I Tried:
In the standalone Module Repo
Moved module logic(i.e .swift .h(header-bridge), .m) files
added $(SRCROOT)/../../../ios/Pods/** to the Header search Paths
No Pods dependencies(i.e no Podfile, Pods etc)(It made sense to not include Pods in the <react-native-my-custom-module> and instead install Pods in the Project.)
In the Project
yarn add <react-native-my-custom-module>
react-native link <react-native-my-custom-module>
added pod 'Firebase/Core' in Pod file and ran pod install
Tried to Build project but get an error that at the line import firebase Error: No such module 'Firebase'
Additionally, If I comment out the import statement import firebase and the code using the External SDK, the remaining methods and logic in the Native Module works(confirmed with JS).
Update: I also tried to install <react-native-my-custom-module> using CocoaPods instead on react-native link i.e by adding the following in my Project Pod file
pod 'RNCustomModule', path: '../node_modules/MyCustomReactNativeMidule/ios/RNCustomModule.podspec'
The Pods successfully get installed but I still get the same Error: No such module 'Firebase'
I'm trying to create a CocoaPod that has OpenSSL-Universal as a dependency. Whenever I go to the auto-generated Example subfolder and run pod install, I get the following error message:
[!] The '…' target has transitive dependencies that include static binaries: (…/Example/Pods/OpenSSL-Universal/lib-ios/libcrypto.a and …/Example/Pods/OpenSSL-Universal/lib-ios/libssl.a)
This error is not there when I remove use_frameworks! from the Podfile in this directory. However, I have another project, a Swift project, which has OpenSSL-Universal as a dependency, and because it's a Swift project, use_frameworks! is present in its Podfile. And yet somehow, it manages to perform pod install with no issues.
I've been trying to create both Swift and Objective-C CocoaPods with the OpenSSL-Universal dependency, and yet to no avail. There are other Pods, however, such as CoreBitcoin, that do have it as a dependency, and they, too, can be included in my Swift projects with use_frameworks!. However, when I try to use CoreBitcoin as a dependency in my own CocoaPod instead of OpenSSL-Universal, the same error is thrown as above, also for OpenSSL-Universal.
How do I make my own CocoaPod with that dependency? What am I doing wrong? I haven't changed any other default settings except for experimenting with the presence of the use_frameworks! flag in the auto-generated example subdirectory.