#import file no error found in cocoaPods when using ObjectiveC in Swift project
I am installing an Objective C object in my swift project. I include "use_frameworks" in the subfile so I don't need to add anything to the bridge header.
The problem is I am including a generated (third party) ObjectiveC file that tries to #import the header from the pod - it fails with "[xxxxx] .h file not found"
The Objective # import "GTLRObject.h" statement causes the "GTLRObject.h not found" error.
My subfile:
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
Overcoming heading. I need to include a header for the generated ObjectiveC class so that 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 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 to reference the GTLRObject from the swift file, I don't get any errors, eg.
import Foundation
import GoogleAPIClientForREST
class ControllerHello: NSObject {
func sayHello(strTest: String){
let gtlObject = GTLRObject
}
}
Any advice is appreciated.
+3
source to share