6

I install an Objective C pod to my swift 3 project. I include “use_frameworks” in the Podfile so I don’t need to add anything to my bridging header.

The problem is when I include a (third party) generated ObjectiveC file that attempts to #import a header from the pod - it fails with “‘[xxxxx].h’ file not found”

The ObjectiveC #import "GTLRObject.h" statement causes "GTLRObject.h file not found" error.

My Podfile:

target 'myHelloWorld' do
 # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
 use_frameworks!
 pod 'GoogleAPIClientForREST'
end

Bridging header. I need to include the header for the generated ObjectiveC class so I can use it in my swift code :

#import "GTLREcho.h"

GTLREcho.h:

// NOTE: This file was generated by the ServiceGenerator.

// ----------------------------------------------------------------------------
// API:
//   echo/v1
// Description:
//   This is an API

#import "GTLREchoObjects.h"
#import "GTLREchoQuery.h"
#import "GTLREchoService.h"

Error is in GTLREchoObjects.h. #import "GTLRObject.h" = "'GTLRObject.h' file not found":

#if GTLR_BUILT_AS_FRAMEWORK
   #import "GTLR/GTLRObject.h"
#else
   #import "GTLRObject.h"
#endif

If I try and reference GTLRObject from a swift file I don't get any error e.g.

import Foundation
import GoogleAPIClientForREST

class ControllerHello: NSObject {

func sayHello(strTest: String){
    let gtlObject = GTLRObject
    }
}

Any advice appreciated.

1
  • Updating User Header Search Paths seemed to resolve this. See this answer. Commented Jun 21, 2017 at 16:12

1 Answer 1

6

Since this answer might be useful for others.

When using GoogleAPIClientForREST:

Open TARGETS > App > Build Settings

For User Header Search Paths add Pods and select recursive.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

$(inherited) as recursive, worked for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.