NewRelicAgent does not work with OCTesting - ios

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.

Related

iOS - Add Swift pod to Objective-C project

Hello I'm working on an old Objective-C project, that has 30+ pods dependecies, all written in Objective-C.
I'm trying to add a Swift pod, this one in particular :
pod 'CSV.swift', '~> 2.4.3'
# ...
# other Objective-C pods ...
# ...
Because I would like to continue new developments in Swift.
But I cannot make it work. If I add use_frameworks!, I get an error at pod install :
The 'Pods-myProject' target has transitive dependencies that include static binaries: (/myProjectPath/Pods/ObjcPod/ObjcPod.framework)
And if I remove use_frameworks!, I get tons of compilation errors, here are some :
Undefined symbol: protocol descriptor for Swift.UnicodeCodec
Undefined symbol: dispatch thunk of Swift.UnicodeCodec.decode<A where A1: Swift.IteratorProtocol, A.CodeUnit == A1.Element>(inout A1) -> Swift.UnicodeDecodingResult
I don't know what I could try otherwise, any help would be much appreciated !
This way you can use swift pod in objective c project try this solution.
Write in your pod file
target 'YourProjectName' do
use_frameworks!
pod 'CSV.swift', '~> 2.4.3'
// Here you can add mode pod as per your requirement Like
pod 'Firebase/Core'
pod 'Fabric'
pod 'Crashlytics'
end
Then Run Pod Install.
For import write this
#import CSV;
And then you have access of your CSV pod files.

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

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

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.

iOS App, Objective-C: Weird Podfile

I am trying to get a app running which was written by some guys some years ago. Instead of a Podfile, the app had a file called SBPodfile with the following content:
#platform :ios, "8.0"
#use_frameworks!
target '------' do
pod 'ZCSFileExtensionForMimeType', :git => 'https://github.com/----/ZCSFileExtensionForMimeType.git'
pod 'AMSlideMenu', '~> 1.5.4'
pod 'SSKeychain'
pod 'SVProgressHUD', '~> 1.1'
SB_PODS_START
ObjCSBLog
ObjCSBDeviceHelper
ObjCSBSynthesizeSingleton
ObjCSBFileHandler
ObjCSBImageCreationHelper
ObjCSBAlertViewHelper
SB_PODS_END
end
target 'actionExtension' do
pod 'ZCSFileExtensionForMimeType', :git => 'https://github.com/-----/ZCSFileExtensionForMimeType.git'
pod 'SSKeychain'
pod 'UAProgressView', '~> 0.1'
SB_PODS_START
ObjCSBLog
ObjCSBDeviceHelper
ObjCSBSynthesizeSingleton
ObjCSBFileHandler
SB_PODS_END
end
target '-----' do
end
The app wouldn't compile because there was no Podfile. So I renamed the SBPodfile to Podfile. Now I am getting the error that the constant "SB_PODS_START" is not defined. I couldn't find out anything about that weird "SB block" on google. Does anyone have a clue what it is.
I have to add that I am relatively new to iOS development, especially in objective c.
Edit: I think that SB stands for the Company which developed the App and they are loading some custom libraries. But I still don't know how it works.

Error ITMS-90206 Invalid bundle contains disallowed file 'Frameworks'

I have a problem uploading my application into the Store via Xcode, this one in particular.
I saw a lot of post about this error, but all are talking about Extension App, that I do not use.
I'm using a Custom framework and Cocoapods.
You can see here my tree :
XXX is my project app name
SharedXXX is my custom framework
Pods is the project created by cocoa pods
Here is my cocoa podFile :
use_frameworks!
link_with 'XXX', 'SharedXXX'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
workspace 'XXX'
xcodeproj 'XXX/XXX.xcodeproj'
xcodeproj 'Shared/SharedXXX.xcodeproj'
def default_pods
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod "SnapKit", '~> 0.17.0'
pod "DKChainableAnimationKit", '~> 1.6.0'
pod "AsyncSwift"
end
def shared_pods
pod "Alamofire", '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift', :git => 'https://github.com/ashleymills/Reachability.swift'
end
target :XXX do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :XXXDev do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :SharedXXX do
xcodeproj 'Shared/SharedXXXX.xcodeproj'
shared_pods
end
Build settings for custom framework (SharedXXX) :
I set the Embedded property to Yes
General Settings for custom framework (SharedXXX) :
The framework provided by Cocoapods is linked.
And to finish,
The General Settings to the main project (App Project : called XXX on the tree)
:
Any idea ?
I solved the problem
Firstly, set into Build Settings
For main project (here XXX) : Embedded Content Contains Swift Code to
YES
Custom Framework (SharedXXX) : Embedded Content Contains Swift Code to NO
Custom Framework (SharedXXX) : Runpath Search Path = #executable_path/../../Frameworks
This helped me solving that issue
I faced the same problem while trying to upload from Xcode 9.3
This happened because I added 'use_frameworks' in my OneSignal
NotificationServiceExtension
The value Always Embed Swift Standard Libraries found in Build Settings should be set to Yes only for you main Projects and not for your custom frameworks or extensions.

Resources