43

I'm trying to add PassSlot into my project, but it says it can't find the .h file. I'm following everything correctly from here: https://github.com/passslot/passslot-ios-sdk

Is this an Xcode 7 problem? It was working fine and now that I opened the project in Xcode 7, it is giving me this problem. I reopened it on Xcode 6 and it starts showing the problem as well.

somepers
  • 529
  • 2
  • 6
  • 9
  • 1
    Whats happening? Are you trying to import the header and its not finding it? Please provide some more details on what you did. Have you set the target membership for the files? – Aggressor Jun 10 '15 at 16:58
  • 1
    Yes, I am trying to import the header and it says it can't be found. I've tried cleaning/building, setting the target membership for the files, and changing the location (from relative to group to relative to project). – somepers Jun 10 '15 at 17:50
  • Youll need to post some screen shots. Something is missing somewhere and I can't tell from your very limited details. Somewhere in your project settings something is mucked. – Aggressor Jun 10 '15 at 20:27
  • 7
    I've noticed that Xcode7 doesn't automatically fill in the required Framework search paths when you import a 3rd party one (I believe Xcode6 **did** do this). Check if yours are empty by going to Project -> Build Settings -> Search Paths -> Framework Search Paths. Fill it in with wherever your Frameworks live. If it's under your project you can use `$(PROJECT_DIR)` – dinesy Jun 28 '15 at 08:39
  • 1
    I ran into this problem and it was due to spaces in my project folder. If you have spaces the path gets split in the Frameworks path settings. If this is the case use double quotes around the path name. – Adam Mendoza Sep 18 '16 at 03:32
  • @AdamMendoza this was my problem xCode not even once – 1800 INFORMATION Aug 28 '20 at 02:26

8 Answers8

47

I think Dinesy is right. This solves the problem for me.

I've noticed that Xcode7 doesn't automatically fill in the required Framework search paths when you import a 3rd party one (I believe Xcode6 did do this). Check if yours are empty by going to Project -> Build Settings -> Search Paths -> Framework Search Paths. Fill it in with wherever your Frameworks live. If it's under your project you can use $(PROJECT_DIR)

Spriter
  • 611
  • 1
  • 5
  • 12
  • 1
    If you have this problem you might also need this follow up question: http://stackoverflow.com/questions/30848208/new-warnings-in-ios9 – PiTheNumber Oct 20 '15 at 08:19
  • This solution works for xcode7. I think xcode the problem is because I didn't Drag&Drop framework and put in custom path and add it through `PhaseBuild>LinkBinaryWithLibraries>add` – Emadpres May 04 '16 at 14:57
24

Replacing #import "Headerfile.h" with #import <Framework/Headerfile.h> worked for me.

BLC
  • 2,240
  • 25
  • 27
  • 2
    after ensuring this import syntax, I get cannot compile module "Frameworkname". This is because the aggregate header contains additional headers. If this is the situation, you have to go to Build Phases of the framework project and ensure that "Headers" has the .h file in question set to public – Nick Jan 20 '16 at 15:40
13

When you Drag & Drop the required framework to your Frameworks folder, Tick on "Destination: Copy items if needed"

Then you would be able to reference it properly now.

Screenshot

mike_manila
  • 131
  • 2
  • 3
6

Just ran into this with Xcode 7 and I ended up having to copy the 3rd party Framework (and bundle) file into my project's main directory before dragging it into the Xcode project. This allowed it to add the correct Framework search path and no longer gave me any problems.

Gowiem
  • 1,297
  • 17
  • 19
2

Just hit this problem myself after making a new test target in Objective-C.

One thing to remember is that under some circumstances, each test target must be listed in the Podfile with pod dependencies. If the Podfile only associates the project with the pods, it may not find the pod header files.

Here's an example of a more complex Podfile from the cocoapods docs.

target 'MyApp' do
  pod 'ObjectiveSugar', '~> 0.5'

  target "MyAppTests" do
    inherit! :search_paths
    pod 'OCMock', '~> 2.0.1'
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    puts "#{target.name}"
  end
end
Luciano
  • 1,119
  • 12
  • 18
1

I ran into this error when trying to link to my own custom framework. The problem was that I hadn't set up my framework to export the needed headers. To do so:

  1. Select each header file you want to make available, go to the File Inspector > Target Membership, and make sure the target is checked and set to "Public".
  2. In the MyFrameworkName.h top-level file, import each header file you want to make available: e.g. #import <MyFrameworkName/MyPublicHeader.h>
Robin Stewart
  • 3,147
  • 20
  • 29
0

In my case, using CocoaPods, Xcode was building fine, but a command line build couldn't locate the framework headers.

The solution was to build the workspace, not the project!

Zaq
  • 1,071
  • 2
  • 10
  • 19
-4

Cleaning the project and restarting XCode sometimes helps

lytridic
  • 325
  • 4
  • 8