Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

How to fix error - Undeclared Identifier Snapshot for Objective-C Project? #397

Closed
varmeh opened this issue Jan 20, 2016 · 7 comments
Closed
Labels

Comments

@varmeh
Copy link

varmeh commented Jan 20, 2016

The swift.h file created by XCode holds no reference to snapshot.

@vpolouchkine
Copy link
Contributor

Did you add the helper and bridge files per https://github.com/fastlane/snapshot#quick-start?

@varmeh
Copy link
Author

varmeh commented Jan 20, 2016

I did. I added -Swift.h to .m files and I could also see that in derived data folder.
Though the bridge header created by XCode hold no reference to Snapshot.

@zauberware
Copy link

Following solution worked for me:

  1. Change "class Snapshot: NSObject" to "@objc class Snapshot: NSObject" in SnapshotHelper.swift
  2. Change the build settings of your test target (not the normal project). Set "Install Objective-C Compatibility Header" to YES.
  3. Clean and build, you should now have a bridge file in your derived data (not in your project).
  4. The bridge file is not added to your project but only to the derived data. Sometimes with a different name than expected and then the import doesn't work. To find it go to XCode-->Window-->Projects, click on the arrow right beside your derived data folder. Finder opens, then search for Swift.h and you will find your bridge file. Import that into your testcase-class via "#import "NameOfYourBridgeFile-Swift.h".

Hope that helps!

@varmeh
Copy link
Author

varmeh commented Feb 3, 2016

Hey Zuber, sorry for delayed response.
I tried all this and it still did not work for me.
Derived header did not have the implementation of snapshot class (checked in derived data folder).
That's why it's still not working for me.

@cguess
Copy link

cguess commented Feb 11, 2016

I'm fighting with the same issues here. @zauberware I've gone through every step you've laid out and Snapshot still cannot be found in my test files as a class. Any ideas?

@zauberware
Copy link

Hi @cguess ,

could you get to step 3 to generate the bridge file in the derived data?
If not you can try to delete and add the UI target again. I had to change the valid target architectures in the build settings of the UI target and the product name to generate the bridge file.

Hope that helps!

Marcus

@fastlane-bot
Copy link

This issue was migrated to fastlane/fastlane#1657. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants