"Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation" - ios

I am using fastlane plugin(aws_device_run_ios) to run the test in device farm in aws, but there some error appears when I run the fastlane command, its nothing to do with AWS, its related to firebase I think, I also using firebase in the project
I didnt find any solution can help me, this is the error I got
❌ /Users/admin/Desktop/MyIOSApp/Pods/FirebaseCore/Firebase/Core/FIRVersion.m:18:2: "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation"
error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation"
^
❌ /Users/admin/Desktop/MyIOSApp/Pods/FirebaseCore/Firebase/Core/FIRVersion.m:22:2: "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation"
error "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation"
^
this the podfile looks like:
# Pods for MyIOSApp
pod 'Alamofire', '~> 4.7'
pod 'RSFloatInputView'
pod 'SkyFloatingLabelTextField', '~> 3.0'
pod 'SwiftyJSON'
pod 'SwiftKeychainWrapper'
pod 'Firebase/Core'
pod 'Fabric', '~> 1.9.0'
pod 'Crashlytics', '~> 3.12.0'
target 'MyIOSAppTests' do
inherit! :search_paths
pod 'Firebase/Core'
# Pods for testing
end
target 'MyIOSAppUITests' do
inherit! :search_paths
pod 'Firebase/Core'
# Pods for testing
end
and this is my fastfile :
lane :aws_device_run_ios do
ENV['AWS_ACCESS_KEY_ID'] = '******'
ENV['AWS_SECRET_ACCESS_KEY'] = '******'
ENV['AWS_REGION'] = 'us-west-2'
#Build For Testing
xcodebuild(
scheme: 'MyIOSApp',
destination: 'generic/platform=iOS',
configuration: 'Release',
derivedDataPath: 'aws',
xcargs: "GCC_PREPROCESSOR_DEFINITIONS='AWS_UI_TEST'
ENABLE_BITCODE=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build-for-testing"
)
# Transform .app into AWS compatible IPA
aws_device_farm_package(
derrived_data_path: "aws",
configuration: "Release"
)
# RUN tests on AWS Device Farm
aws_device_farm(
device_pool: "DeviceIOS"
)
end
how to solve this error, in the error mentioned that to add -DFirebase_VERSION=... I did not know how and where to do that?!
please help thanks in advance

It looks like the fastfile is overriding the GCC_PREPROCESSOR_DEFINITIONS options for building the FirebaseCore pod. "GCC_PREPROCESSOR_DEFINITIONS": "FIRCore_VERSION=5.4.1 Firebase_VERSION=5.20.0" from https://github.com/CocoaPods/Specs/blob/master/Specs/8/b/d/FirebaseCore/5.4.1/FirebaseCore.podspec.json#L42.
I don't know much about fastlane, but xcargs is probably not the right place to add GCC_PREPROCESSOR_DEFINITIONS='AWS_UI_TEST'. It should be on a setting that is specific to building a unit test target, not a setting that affects all of the targets in the app.

Related

Remove pod dependency based on platform

I'm adding an apple watch extension to my project and I'd like to use the same pods I'm using for my main iOS app. However, the podspec I'm using for my iOS app has a dependency that causes an error when I include the watch extension as a target in my podfile. Is there a way to remove dependencies based on platform (ios, watchos)?
The error:
[!] The platform of the target `My Watch Extension` (watchOS 5.2) is not compatible with `Library X (10.1.19)`, which does not support `watchos`.
So far I'm doing the following in my podfile:
target 'My Watch Extension' do
platform :watchos, '5.2'
pod 'MyPod', :path => 'MyPod'
end
And I added the following to my podspec:
s.platforms = { :ios => "10.0", :watchos => "5.2"}
Is it possible to have to separate podspecs?
You can set different dependencies for different platforms
spec.dependency 'Alamofire'
spec.ios.dependency 'Crashlytics'
Here is a simplified version of my podfile. I just include different pod's for the different targets.
def external_dependencies
pod 'Alamofire'
pod 'SQLite.swift/SQLCipher'
end
def caller_id_external_dependencies
pod 'GMCPagingScrollView'
pod 'KeychainAccess'
end
target 'Goob' do
external_dependencies
internal_dependencies
target 'UnitTests' do
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'SQLite.swift/SQLCipher'
inherit! :search_paths
end
end
target 'GoobCallerId' do
caller_id_external_dependencies
end

Cocoapod can't identify my target after it was renamed

I had been using cocoapods to pod stuff but after I've renamed my whole xcode project, the cocoapod doesn't reconise my renamed target when I am trying to pod lottie, and I don't know how to replace the target with the new one
This error showed in terminal
[!] Unable to find a target named `Infinity Math`, did find `Infinity Math.temp_caseinsensitive_rename`, `Infinity Math.temp_caseinsensitive_renameTests`, and `Infinity Math.temp_caseinsensitive_renameUITests`.
My Pod file
platform :ios, '12.0'
target 'Infinity Math' do
use_frameworks!
pod 'UITextField+Shake', '~> 1.2'
pod 'SPAlert'
pod 'CBFlashyTabBarController'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'lottie-ios'
target 'InfinityMathTests' do
inherit! :search_paths
end
target 'InfinityMathUITests' do
inherit! :search_paths
end
end
What should I do next in order to pod new pods?
Give the targets in the Podfile the same names that show up in Xcode:
target 'Infinity Math' do
target 'Infinity MathTests' do
target 'Infinity MathUITests' do
I've fixed it by renaming the target to the ones in the error
InfinityMath.temp_caseinsensitive_rename,
InfinityMath.temp_caseinsensitive_renameTests, InfinityMath.temp_caseinsensitive_renameUITests
It's weird

Please add the host targets for the embedded targets to the Podfile

My project is in Swift 2.0. I am try all possible ways but not found any solution.
My pod file
# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, :deployment_target => '8.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
def available_pods
pod 'IQKeyboardManager'
pod 'Instabug'
pod "TSMessages"
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
pod 'Onboard' # not used
pod 'DZNEmptyDataSet' # not used
pod 'iOS-Slide-Menu'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'HanekeSwift', :git => 'https://github.com/Haneke/HanekeSwift.git'
pod 'Alamofire'
pod 'ObjectMapper', :git => 'https://github.com/Hearst-DD/ObjectMapper.git'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'SCLAlertView'
pod 'ImageLoader'
pod 'NVActivityIndicatorView', :git => 'https://github.com/ninjaprox/NVActivityIndicatorView.git'
pod 'ActiveLabel'
pod 'MWFeedParser'
pod "SwiftElegantDropdownMenu"
pod 'SwiftHEXColors'
pod 'UITextView+Placeholder'
pod "AFDateHelper"
pod 'DateTools'
pod "SwiftDate", "~> 2.0"
pod 'APAddressBook/Swift'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'PusherSwift', git: 'https://github.com/pusher/pusher-websocket-swift.git', branch: 'push-notifications'
end
def available_pods_exc
pod 'Alamofire'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
end
target 'link' do
available_pods
end
target 'ReadLaterExtension' do
available_pods_exc
end
target 'Link Tests' do
pod 'Quick', '0.3.1'
pod 'Nimble'
end
I found below error
[!] Unable to find host target(s) for ReadLaterExtension. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
The problem is not in the podfile, but in the project!
To fix:
Go to XCode
Select your HOST target.
Open the target's 'General' page
In the 'Embedded Binaries' section, make sure your EXTENSION target is present.
In your Podfile you should have:
target 'HostApp' do
....
target 'YourExtension' do
....
end
end
In order to disable building/running the NSExtension you build, you should:
Click the project file in the project navigator
Click the containing app target (the one you DO want to run)
Click Build Phases tab
Open Target Dependencies
Remove the extension (the one you DON'T want to run)
To bring it back, simply click the + sign in the same place and
re-add it.
In my case working sucessfully
For future reference I would like to add one reason I just discovered for this error message:
In the Main Targets Build Phases the section Embed App Extensions has to be above the [CP] Copy Pods Resources and [CP] Embed Pods Frameworkds.

Running 1 of 2 custom shell script stuck for 2 minutes in Xcode

Running 1 of 2 custom shell scripts it stuck for 2 minutes while trying to build the app.
I tried to fix with the solution :Xcode custom shell scripts are slowing down the compiling time , but still it slows the build process :(.
Build Stuck for 2m here
Build Phases
Further informations:
Xcode 8.1
Swift 3.0
Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'MyProject' do
# Network
pod 'Alamofire'
pod 'SwiftyJSON'
# UI side
pod 'Material', git: 'https://github.com/CosmicMind/Material.git', branch: 'development'
pod 'SDWebImage'
pod 'UIScrollView-InfiniteScroll'
pod 'TPKeyboardAvoiding'
pod 'SwiftKeychainWrapper', git: 'https://github.com/jrendel/SwiftKeychainWrapper.git', branch: 'develop'
pod 'DropDown'
# Facebook
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
# Autolayout
pod 'SnapKit'
pod 'KeepLayout'
# Metrics
pod 'Google/Analytics'
# Fabric.io
pod 'Fabric'
pod 'Crashlytics'
end
target 'MyProjectTests' do
end
target 'MyProjectUITests' do
end
Finally, I found a solution for this. At least the total build time now is 57sec.
I found that 'Embed Pods Framework' (Once 'Embed Pods Framework' and 'CP Embed Pods Framework') builds twice. Anyway, I don't have an idea why I have both of them on build phases.
I found for this on Report Navigator.
Solution:
1) I let only active ✓ Run script only when installing only for'[CP]Embed Pods Framework'
2) Optimization Level on Build Settings for debug was -None. I set to Fast...
3) Tip: use Simulator instead of Device for minimal build time.
Added this at the end of you Podfile
post_install do |installer|
puts("Update debug pod settings to speed up build time")
Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file|
File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" }
end
end

NewRelicAgent does not work with OCTesting

I have a problem with the NewRelicAgent pod.
It works fine with the nomral app targed und runs well in the simulator, but as soon as I start the test target, I get the the following error message:
ld: framework not found NewRelicAgent
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My pod file looks like this:
platform :ios, '5.0'
pod 'RestKit', '~> 0.20.0rc'
pod 'RestKit/Testing', '~> 0.20.0rc'
pod 'RestKit/Search', '~> 0.20.0rc'
target :test do
link_with :DealiniTests
pod 'Expecta', '0.2.1'
end
pod 'GoogleAnalytics-iOS-SDK', '~> 2.0beta4'
pod 'NewRelicAgent', '~> 1.328.0'
pod 'Parse', '~> 1.2.9'
I think the problem is, that the PATHS links to a path "{PODS_ROOT}/BuildHeaders/NewRelicAgent" which does not exsits.
I have no NewRelicAgent folder in the Headers and BuildHeaders folder but it does work for the normal target just for the test target not.
All other pods works fin just the newrelic does not work.
The Problem is, that CocoaPods does not automaticly add the NewRelic framework to the
FRAMEWORK_SEARCH_PATHS
I just added "$(PODS_ROOT)/NewRelicAgent/NewRelic_iOS_Agent_1.328" to the FRAMEWORK_SEARCH_PATHS of the test target and it worked
I am not sure if this would be a good solution, but try to add pod 'NewRelicAgent', '~> 1.328.0' to your test target as well. I did that in order to be able to use RestKit classes in my tests. The only difference is that I have my test target declared as exclusive in my podfile.
try adding $(FRAMEWORK_SEARCH_PATHS) to your "Framework Search Paths" in the test target build settings. It appears cocoapods doesn't set up the headers and search paths correctly for this particular pod.

Resources