Issue using static framework crashlytics - swift

I have a A.framework which i am using in my swift app Test.
A.framework has a podspec which has s.dependency = 'Crashlytics'
Now when i do pod install on swift app Test, in Test's podfile i have to write below since i am using static framework:
pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
def installer.verify_no_static_framework_transitive_dependencies; end
end
Now when i compile Test, it give me 'Crashlytics, file not found error'.
If i manually go to Test->Pods->A->Link binary with library->browse and add crashlytics.framework, error goes away.
How can i add a run script which will automate this manual step for me.
Thanks.

Related

No such module RealmSwift

This is not a duplicate question.
I have been using realm for a long time. Recently I am getting the error of "No such module RealmSwift". But this is happening only in release target scheme not in build target scheme. Is there any particular reason as to why it is not working only in release? I have seen this question at a lot of places but none of those solutions worked for me.
My podfile looks similar to this:
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
#use_modular_headers!
inhibit_all_warnings!
def shared_pods
pod 'RealmSwift'
end
target ‘************’ do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ************
shared_pods
target '************Tests' do
inherit! :search_paths
# Pods for testing
end
end
target '************UITests' do
inherit! :search_paths
# Pods for testing
# shared_pods
end
This is more of a troubleshooting step than a direct answer since I duplicated your issue.
You've been using Realm a while so you know this but for future readers, ensure that any file where you're using RealmSwift includes
import RealmSwift
I just tried your podfile on a new project and am getting weird behavior as well. I replaced your podfile with the following 5 lines and it works correctly.
project 'Realm Test.xcodeproj'
target 'Realm Test' do
use_frameworks!
platform :osx, '10.13'
pod 'RealmSwift'
end
That was a macOS project but it worked equally well with an iOS project. On that project I uncommented #platform :ios, '12.0'
I think this is the issue
inherit! :search_paths
That lets the target know about the search paths but does not link them in. I would suggest changing that to
inherit! :complete
Which appears to be working in my project.
Oh - for completness, I ran into this once as well and the solution was
add the parent path of RealmSwift.framework (i.e., the containing
directory) to your framework search paths.
This is a common Realm bug which occurs in Xcode after pod install. Clean and Build the project once, the bug should go away!

No such module 'InputBarAccessoryView'

Trying to get MessageKit setup within my project. I'm getting the following error - 'No such module 'InputBarAccessoryView' within the
MessagesViewController+Keyboard.swift:26:8: No such module 'InputBarAccessoryView'
I've tried installing pods, updating pods and deintegrating.
import Foundation
import InputBarAccessoryView
Should compile normally. Only error that persists.
In My case i will update pod file Ios version
# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
target 'Messanger' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Messanger
pod 'InputBarAccessoryView'
end

Using static libraries in Swift with CocoaPods fails for Realm

Since Xcode 9 it is possible to use static libraries by omitting the use_frameworks! flag in the Podfile. However, when used with the Pod RealmSwift this results in the following error:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RealmSwift` depends upon `Realm`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
Sadly, the proposed solution with use_modular_headers! does not work.
Other things I have tried include:
Using the latest Realm version (3.15.0)
Use the Objective C version and add Swift support, this won't build and give a module not found error in the RLMSupport.swift file .
Adding a bridging header for the Objective C version.
Endless clean, rebuild, Xcode relaunches and Derived Data folder cleaning.
It would not be preferable to circumvent CocoaPods and have this dependency be installed in a separate way, since that would make updating a more complex process. I hope there is a solution that works with CocoaPods, Realm and Swift.
I did the job doing following:
pod 'RealmSwift', '~> 3.17', :modular_headers => true
pod 'Realm', '~> 3.17', :modular_headers => true
As far as I can tell adding use_modular_headers! to top of Podfile works.
Adding s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } to .podspec doesn't work as far as I can tell. (Cocoapods 1.6.0-beta.2)
example:
target 'Opportunity' do
use_modular_headers!
end
I don't see why it wouldn't work. I got the same issue, and I added use_modular_headers! following way in the podfile and it worked.
target 'Pick Up Lines' do
use_modular_headers!
pod 'RealmSwift'
end
By the way, before doing any of it, make sure, you set the deployment target of the project as 11.0.

Xcode error: Missing required module 'Firebase'

The problem:
I have a dynamic framework, which uses Firebase added by cocoapods. And I also have the App, which uses this dynamic framework. But when I try to build the project I got error Missing required module Firebase.
I tried the following:
remove derived data + clean
re-install pods
add 'Import paths' to the build settings (in this case I got error 'Library not loaded' in runtime)
My podfile:
target 'Project' do
...
end
target 'Framework' do
pod 'Firebase/Core'
pod 'Firebase/Auth'
end
The Framework is added to Embedded binaries and Linked Frameworks and Libraries.
For anyone still having this issue, doing this solved it for me.
Add this to your test target build settings.
HEADER_SEARCH_PATHS = "${SRCROOT}/Pods/Firebase/CoreOnly/Sources"
Full discussion can be found on firebase GitHub issues.
you can find HEADER_SEARCH_PATHS in Test Target > Build Settings > Search Paths > Header Search paths.
Just incase you cant find HEADER_SEARCH_PATHS in Build Settings, click the ALL button to show all settings.
Add the following to your test target:
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Firebase/CoreOnly/Sources"
That’s in test target > Build Settings > Header Search Paths.
After adding test target, running:
pod install
and add to:
HEADER_SEARCH_PATHS = $(inherited)
fixed for me.
On Framework Search Path pod put all pod projects path automatically.
Of course, to podfile added this after last pod name:
target 'TestTargetName' do
inherit! :search_paths
end
Nothing did help to me until
target 'TestTargetName' do
pod 'Firebase/Storage'
end
I'm not sure what firebase does so I can't run tests (tests do not depend on firebase at all)

Google/Analytics.h file not found when Testing

I am including the BridgingHeader.h however on importing Google/Analytics.h it can't find the file.
This works fine in the application, it only throws the error under testing.
Not sure what the issue is so any insight would be greatly appreciated.
I had a similar issue and fixed it by adding the Google Analytics pod to both the tests and uitests targets by opening up your podfile and modifying it as shown:
target 'MyApp' do
pod 'Google/Analytics'
end
target 'MyAppTests' do
pod 'Google/Analytics'
end
target 'MyAppUITests' do
pod 'Google/Analytics'
end
Once that was complete I had to run pod install twice and then it worked.
Spent near 2 hours on searching and finally found correct solution to all that madness! Accepted solution above is working, but gives a lot of Class GAIUtil is implemented in both... warnings which is not quite right that means.
Solution
You need to use cocoapods 1.0.0.beta6+
Your test target should be defined in your Podfile as next:
target 'App' do
pod 'GoogleAnalytics' , '~> 3.0'
# your other pods
target 'AppTests' do
inherit! :search_paths
# your other testing pods/frameworks
end
end
Do pod update.
All that found there https://github.com/CocoaPods/CocoaPods/issues/4626#issuecomment-210402349