Xcode 7 can't find header files from framework

后端 未结 8 1287
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 19:03

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<

相关标签:
8条回答
  • 2021-02-03 19:11

    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

    0 讨论(0)
  • 2021-02-03 19:12

    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
    
    0 讨论(0)
  • 2021-02-03 19:12

    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>
    0 讨论(0)
  • 2021-02-03 19:21

    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.

    0 讨论(0)
  • 2021-02-03 19:23

    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)

    0 讨论(0)
  • 2021-02-03 19:29

    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!

    0 讨论(0)
提交回复
热议问题