Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'XCTContext' has no member 'runActivity' #258

Closed
verodanilova opened this issue Nov 23, 2022 · 9 comments · Fixed by #276
Closed

Type 'XCTContext' has no member 'runActivity' #258

verodanilova opened this issue Nov 23, 2022 · 9 comments · Fixed by #276

Comments

@verodanilova
Copy link

Hey!
After the update to v. 9.5.0, our snapshot tests target doesn't work because of a compiler error:

***/Pods/Nimble-Snapshots/Nimble_Snapshots/HaveValidSnapshot.swift:105:20: error: type 'XCTContext' has no member 'runActivity'
        XCTContext.runActivity(named: name) { activity in
        ~~~~~~~~~~ ^~~~~~~~~~~

Could you please check what's wrong? 🙏

@ashfurrow
Copy link
Owner

Hi @verodanilova, sorry to hear you're having trouble. I need some more information to help us track this down.

Can you confirm your integration with the library? CocoaPods, right? Anything weird in your Podfile? Which previous version were you using that did work? 9.4.0? Xcode and iOS target deployment versions? Thanks!

@verodanilova
Copy link
Author

Hey @ashfurrow ! Thanks for your answer.

  • We use CocoaPods 1.11.3, seems that nothing weird in Podfile
  • This started to happen after the following pods update:
    • Nimble (10.0.0) -> Nimble (11.2.1)
    • Nimble-Snapshots (9.4.0) -> Nimble-Snapshots (9.5.0)
    • Quick (5.0.1) -> Quick (6.0.1)
  • XCode 14.0.1 and iOS 15 deployment target

@verodanilova
Copy link
Author

Hey @ashfurrow ! Do you have any news so far?

@ashfurrow
Copy link
Owner

Hi. Sorry I don’t have the capacity to work on this right now. I’d welcome a pull request but I can’t troubleshoot right now.

@verodanilova
Copy link
Author

Hey! No problem! Then I will wait for your answer as soon as you have time 🙏

@hfehrmann
Copy link
Collaborator

Hi @verodanilova!

Do you mind to publish a minimum working example showing the failure? That way, other people could take a look if they have time.

@verodanilova
Copy link
Author

Hey @hfehrmann !
I'd love to, but I can't because it's a commercial project and I'm forbidden to share the code, sorry 😞

@hfehrmann
Copy link
Collaborator

@verodanilova I was thinking in sharing an example project, without any private code.

anton-plebanovich added a commit to anton-plebanovich/Nimble-Snapshots that referenced this issue Oct 25, 2023
@anton-plebanovich
Copy link
Collaborator

I am not sure what the core reason is, but this PR helped me to solve the issue https://github.com/pointfreeco/swift-snapshot-testing/pull/455/files

For some reason Nimble-Snapshots does not have ENABLE_TESTING_SEARCH_PATHS enabled. A local project workaround is

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'Nimble-Snapshots'
        config.build_settings['ENABLE_TESTING_SEARCH_PATHS'] = 'YES'
      end
    end
  end
end

To fix the core issue we need to update the podspec file from

  s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }

to

  s.pod_target_xcconfig = { 
    'ENABLE_BITCODE' => 'NO',
    'ENABLE_TESTING_SEARCH_PATHS' => 'YES',
  }

Here is an example of how it was done in the Nimble https://github.com/Quick/Nimble/blob/main/Nimble.podspec

And here is a pull request #276

ashfurrow added a commit that referenced this issue Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants