pableiros
pableiros

Reputation: 16042

Value of type has no member 'measure' when using XCTest on Xcode 8 beta

I'm using Xcode 8 beta, when I create an iOS project with Unit Test included, I added the cocoapods on my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'RealmSwift'
pod 'Reachability', '~> 3.2'
pod 'Alamofire', '~> 3.0'
pod 'ChameleonFramework/Swift'
pod 'SwiftyBeaver'
pod 'GMStepper'

Then I ran the command to init the cocoapods:

pod install

After that I open the project.xcworkspace file and then I get these errors:

Swift Compiler Error

Value of type '[ProjectName]Tests' has no member measure'

enter image description here

Ditto Error

Command /usr/bin/ditto failed with exit code 1

enter image description here

I just did simple things to create my workspace like I use to do with Xcode 7.3 but this time I can't.

And ideas to solve this?

Upvotes: 3

Views: 2750

Answers (3)

pableiros
pableiros

Reputation: 16042

After months of researching I finally solve the errors. The problem was on my cocoapods file. I have to specify the target for the main project and for the Unit Test project. This is what it looks like now my cocoapods file:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target "ProjectName" do
    pod 'RealmSwift'
    pod 'Reachability', '~> 3.2'
    pod 'Alamofire', '~> 3.0'
    pod 'ChameleonFramework/Swift'
    pod 'SwiftyBeaver'
    pod 'GMStepper'
end

target "ProjectNameTests" do
    pod 'RealmSwift'
    pod 'Reachability', '~> 3.2'
    pod 'Alamofire', '~> 3.0'
    pod 'ChameleonFramework/Swift'
    pod 'SwiftyBeaver'
    pod 'GMStepper'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

Then I ran pod update and I cleaned the project and when I builded the project, all the Unit Tests errors gone.

Upvotes: 0

Cliff Pruitt
Cliff Pruitt

Reputation: 201

I wish I had better knowledge of the issue and could offer a more detailed explanation as to the cause of the errors. I very much dislike "magic" solutions without understanding why they work. That said, magic solutions are better than none at all soooo....

I encountered the problem described above, and came across this SO question while looking for a solution but unfortunately didn't come across a solution. Out of frustration I tried cleaning my project (Product > Clean) which resolved the issue.

I would suspect that something about the cocoapods setup caused some "leftovers" of some sort but it would take someone more experienced than I to delve into the details.

Upvotes: 4

hEADcRASH
hEADcRASH

Reputation: 1915

This is really late, and you have probably discovered the solution already. I came here with the same question and don't see an answer, so I'm just posting for reference.

func measure( () -> Void)

...seems to have disappeared.

public func measureBlock(block: () -> Void)

...works, though.

Upvotes: 2

Related Questions