I have Swift 2.3 project working fine with AWS Libraries. I just tried to create a sample unit test for this and I get this error. It seems my unit test class cannot find the frameworks I installed using a Podfile
This is the unit test class
import XCTest
import UIKit
@testable import safetyv1
class OffenceFormVCTests: XCTestCase {
var vc:OffenceFormVC!
override func setUp() {
super.setUp()
// called first
vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("OffenceFormVC") as! OffenceFormVC
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
}
This is the error I get when I do Product > Build for > Testing
And my build settings
Podfile
Anyone knows how to fix this issue? Thanks a lot!
I had the same problem it seems to be an easy fix. Just add your testing target in your podfile as another target withe same pods.
Your podfile should contain something like this:
target: 'safetyv1Tests' do
pod 'AWSCore'
pod 'AWSS3'
end
For Carthage you need to add the frameworks to the test target
Greetings, Alex
I issue the exact same problem and pass one day to find the answer.
Problem is that when you add your project with cocoapod, you add pod to your project only.
So to solve this issue you need to add this in your PodFile:
target :'YourPojectTests' do
pod 'AWSAutoScaling'
pod 'AWSCloudWatch'
pod 'AWSCognito'
pod 'AWSCognitoIdentityProvider'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSElasticLoadBalancing'
pod 'AWSIoT'
pod 'AWSKinesis'
pod 'AWSLambda'
pod 'AWSMachineLearning'
pod 'AWSMobileAnalytics'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSimpleDB'
pod 'AWSSNS'
pod 'AWSSQS'
end
and replace "YourProjectTests" by your project tests name bundle
Just need to do :
pod update
And open your project.workspace on Xcode to get it working.
Safe check is to go in your projecNameTests settings and check that all -framework are set in linker section as shown like in yourProject settings
Enjoy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With