Xcode Unit Testing with Cocoapods
The solution for me was to update cocoapods to version 1.1.0.rc.2.
sudo gem install cocoapods --pre
Why can't Xcode find my App for Unit Tests?
You must use @testable import
to import your app's module for unit testing. You have to supply the name of your application target, Pods_MyApplication_Example, not the name of the project. In your example it will look like the following:
@testable import Pods_MyApplication_Example
And remove the import statement that imports the app target.
Unable to use Cocoapod in Unit Tests
As far as I know that warning is not something you did. I think I saw some other people having the same issue and as far as I can tell it's a problem in the latest SDK from Apple. I say you can safely ignore it for now. Here are some people having the same issues:
- Class PLBuildVersion is implemented in both frameworks
- Class PLBuildVersion is implemented in both/Applications
Check this answer to get more info.
How to use unit test cases (added to a development pod as test_spec) in the main app target?
Once you have the target you need to edit your scheme to make it run the tests!
Then set it to be tested (by adding it to the +)
Also it is added automatically to the build
And its done! :D
COCOAPOD file not found for Xcode unit tests only
Add the pods separately for Target and TargetTests
Make the following changes in POD file
target ‘Target’ do
platform :ios, ‘8.0’
use_frameworks!
pod 'PLCrashReporter'
end
target 'TargetTests' do
platform :ios, ‘8.0’
use_frameworks!
pod 'PLCrashReporter'
end
Go to the Build Settings of TargetTests
and set the value for “Other Linker Flags” as $(inherited)
Do a POD install then do Clean Build Folder and run
Related Topics
iOS - Return to Safari from Native App Without Opening New Tab
How to Make Cmake Use Specific Compiler and Flags When Final Compilation Stage Instead of Detection
Get Camera Field of View in iOS 11 Arkit
Uitableview:Viewforheaderinsection: Not Called During Reloaddata:
How to Get Enum from Raw Value in Swift
Could Not Instantiate Class Named Ibnslayoutconstraint
How to Force My Keyboard to Be Up on My Program's Start in Swift
How to Return Value After the Execution of the Block? Swift
App Transport Security Does Not Work Any More with iOS 11 Xcode 9
How to Use Device Instead of Simulator
How to Upload Audio with Alamofire Multipart Upload
Adding Multiple Arrays to Form One Final Array. Debug Swift Xcode
No Such File and Directory Found Xcode 7
Return Lighter Color from Skcolor Using Hsl Lightness Factor
Phone Call Number with Hashtag on iOS
Can't Set Titleview in the Center of Navigation Bar Because Back Button