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

KIF/KIF.h file not found #765

Closed
janagrill opened this issue Jan 7, 2016 · 27 comments
Closed

KIF/KIF.h file not found #765

janagrill opened this issue Jan 7, 2016 · 27 comments

Comments

@janagrill
Copy link

I am trying to integrate KIF into my AppleTV project. I'm using Xcode 7.2, programming in Swift and integrating KIF as download from GitHub. I followed all the steps in README, including the "Use with Swift" part, importing KIF in my bridging header and setting the path to this bridging header in Build Settings of my testing target. However when I try to run the tests with ⌘U (I did not really write any yet even, using the default implementation) I get the following two errors:

  • Tests-Bridging-Header.h -> 'KIF/KIF.h' file not found
  • Failed to import bridging header '/path/Tests-Bridging-Header.h'

I assume that the second error will disappear once the first one is solved, but I do not know how to solve it. Any ideas?

@janagrill
Copy link
Author

Additionally, I tried running the example project Testable Swift and this does not work either. First of all some of the syntax has to be changed, and there are still errors there:

screen shot 2016-01-07 at 14 52 35

@kenji21
Copy link
Contributor

kenji21 commented Jan 7, 2016

This error can be solved adding -framework IOKit to linker flags

@janagrill
Copy link
Author

Ah, okay, that is correct, thanks. However, I did this is my own project already, but the errors I listed above are still there.

@phatmann
Copy link
Contributor

phatmann commented Jan 7, 2016

Can you post the contents of your bridging header here please?

@janagrill
Copy link
Author

Well, for now it is a copy of the bridging header from Testable Swift project, i.e. it only contains the line #import <KIF/KIF.h>

@phatmann
Copy link
Contributor

phatmann commented Jan 7, 2016

Take a look at the header search paths in your build settings. Somehow KIF.h is not in the search path.

@miguelcampiao
Copy link

Having the exact same issue. None of the proposed workarounds is helping.

@melvynhills
Copy link

I have the same issue in an Objective-C project. I followed the Readme instructions for the Github installation.

@melvynhills
Copy link

Fixed it by adding $(SRCROOT)/Frameworks/KIF to Build Settings > Search Paths > Header Search Paths, and then #import "KIF.h" instead of #import <KIF/KIF.h>

@phatmann
Copy link
Contributor

@janapejic, @miguelcampiao: does the suggestion from @melvynhills fix your issue?

@miguelcampiao
Copy link

Nope. It did not fix it.

I ended up creating a project from scratch, adding KIF as a pod, and it worked.
The rest of the settings were exactly the same, to the best of my knowledge.

@melvynhills
Copy link

Additional info: make sure to choose recursive next to $(SRCROOT)/Frameworks/KIF

@leostratus
Copy link

I'm having this same issue with XCode 7.2 except I'm installing by way of CocoaPods. My project is written in Swift, and was making successful use of a Bridging Header to use another framework written in Obj-C just fine prior to trying to install KIF.

None of the proposed workarounds solve the problem.

For the other folks in this thread that have this problem, are you also on XCode 7.2 like @janapejic and I? Has anyone tried to use a 7.3 beta to see if this makes a difference?

Maintainers: what other information can I give you to help diagnose the problem?

@mtitolo
Copy link

mtitolo commented Mar 8, 2016

I'm having a similar issue. Question to others: Are you trying to import/use KIFUITestActor anywhere?

@leostratus
Copy link

I had a bit of a eureka moment looking at #809. I realized that I had followed the docs to the letter and that was my problem. Some of the KIF instructions are not entirely clear for usage with Swift. Namely, there is one section about installing via CocoaPods, and another for 'Using Swift', but neither section really covers the case of 'Using CocoaPods with Swift' very clearly.

I had been building KIF as a framework (use_frameworks! in my Podfile etc) via CocoaPods and without thinking much about it I followed the instructions where it told me to put #import <KIF/KIF.h> in my Bridging Header as described in the docs, under the 'Use with Swift' section of the installation instructions:

Your test bundle's bridging header will need to #import <KIF/KIF.h>, since KIF is a static library and not a header.

If KIF is built as a Framework via CocoaPods then it shouldn't be included in the Bridging Header (there are some circumstances where this might be false, but largely the advice in this article seems reasonable).

When I removed KIF from the Bridging Header, I tried to build the test target again and I received the same error as in #809. I solved the public vs. private issue the same way as @mtitolo did while waiting on PR #810 since this is/was a huge blocker for me, and now everything seems golden.

I hope that helps folks using CocoaPods stuck on this!

@ghost
Copy link

ghost commented Mar 17, 2016

Is this issue resolved ? Am still facing the issue with Xcode's new iOS UI Bundle & iOS Unit Test bundle (Objective-C). I am not using cocoa pods but installed through git submodule mechanism.
If I try the solution given by @melvynhills by adding header search paths. Then the same error is popping up in KIF library headers wherever KIF/KIF.h header is used.

@mtitolo Yes I am using KIFUITestActor to create category of it and add

My error is displayed in the image below
screen shot 2016-03-17 at 8 18 05 pm

@mikelupo
Copy link
Contributor

Only works with Unit test targets. Not UI test target. Could that be the issue?

On Mar 17, 2016, at 10:53 AM, Vignesh Raj S notifications@github.com wrote:

Is this issue resolved ? Am still facing the issue with Xcode's new iOS UI Bundle & iOS Unit Test bundle (Objective-C). I am not using cocoa pods but installed through git submodule.
If I try the solution given by @melvynhills by adding header search paths. Then the same error is popping up in KIF library headers wherever is used.

@mtitolo Yes I am using KIFUITestActor to create category of it and add

(void)navigateToLoginPage; Like described in https://github.com/kif-framework/KIF
My error is displayed in the image below


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@ghost
Copy link

ghost commented Mar 17, 2016

@mikelupo No I tried installing KIF in Unit test targets too by creating new target. But I ended up facing the same issue.

@timendez
Copy link

I'm having the same issue, ObjC by importing the framework without cocoapods

@phatmann
Copy link
Contributor

@timendez: did you try any of the fixes in the comments above?

@timendez
Copy link

@phatmann Yes, they didn't work. I ended up solving my issue by simply re-adding the KIF.framework to Link Binary With Libraries in Build Phases. I could drill down command-clicking on the #import <KIF/KIF.h> line, so something was linked up first.

@erustique
Copy link

I need to access the camera to scan photos and so I need to run on the device.

I have already tested on the iPhoneSimulator with this project, just fine, so I think I'm linking correctly. I added arm64 in the Info.plist file under UIRequiredDeviceCapabilities, either way, still won't build right. Ideas?

Ld build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests normal arm64
cd ./MyApp
export IPHONEOS_DEPLOYMENT_TARGET=10.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -L./MyApp/build/Products/Debug-iphoneos -L./MyApp/build/Products/Debug-iphonesimulator -F./MyApp/build/Products/Debug-iphoneos -F./MyApp -F./MyApp/MyAppTests -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -filelist ./MyApp/build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=10.1 -dead_strip -bundle_loader ./MyApp/build/Products/Debug-iphoneos/MyApp.app/MyApp -Xlinker -object_path_lto -Xlinker ./MyApp/build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker ./MyApp/build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests.swiftmodule -ObjC -framework XCTest -framework IOKit -framework XCTest -framework IOKit ./MyApp/build/Products/Debug-iphoneos/libKIF.a -Xlinker -dependency_info -Xlinker ./MyApp/build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests_dependency_info.dat -o ./MyApp/build/Intermediates/MyApp.build/Debug-iphoneos/MyAppTests.build/Objects-normal/arm64/MyAppTests

ld: warning: ignoring file ./MyApp/MyAppTests/IOKit.framework/IOKit, missing required architecture arm64 in file ./MyApp/MyAppTests/IOKit.framework/IOKit (2 slices)
Undefined symbols for architecture arm64:
"_IOHIDEventCreateDigitizerEvent", referenced from:
_kif_IOHIDEventWithTouches in libKIF.a(IOHIDEvent+KIF.o)
"_IOHIDEventCreateDigitizerFingerEventWithQuality", referenced from:
_kif_IOHIDEventWithTouches in libKIF.a(IOHIDEvent+KIF.o)
"_IOHIDEventSetIntegerValue", referenced from:
_kif_IOHIDEventWithTouches in libKIF.a(IOHIDEvent+KIF.o)
"_IOHIDEventAppendEvent", referenced from:
_kif_IOHIDEventWithTouches in libKIF.a(IOHIDEvent+KIF.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@phatmann
Copy link
Contributor

phatmann commented Nov 28, 2016

@erustique Since this is a different issue, can you please file a new ticket? Thanks.

@phatmann
Copy link
Contributor

Closing, since it is inactive and workarounds have been found.

@lidongyangLeo
Copy link

@janapejic
how to solve this issue ?
I have the same problem, I don't konw how to solve it.

@reallyyun
Copy link

if you use cocoaPod set up KIF, you should go to project settings -> Header Search Paths, add "${PODS_ROOT}/KIF/Classes. Then in your test file #import "KIF.h"

@justinseanmartin
Copy link
Contributor

With CocoaPods, you should be able to just use #import <KIF/KIF.h> and not need to set any special header search paths. You could also try upgrading to the latest version of CocoaPods and give that a shot.

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

No branches or pull requests