4

I have downloaded latest GeoFire framework v1.1.3 from here and dropped it in my Swift Xcode project but my import GeoFire statement is throwing

No such module 'GeoFire'

This is very strange because a few minutes ago I did the same for Firebase framework and it is working fine. My target is iOS 8.0 and I believe I do not need Bridging header.

Framework is present in linked frameworks and libraries , Embedded Binaries and link binary with libraries.

Kashif
  • 4,642
  • 7
  • 44
  • 97
  • I strongly recommend you to use cocoapods. No more headache, just add `pod 'GeoFire'` to Podfile, print `pod install` in terminal and use it in code. – Leo Mar 24 '16 at 06:17
  • Yeah I know, I just don't like to use cocoa pods and complicate workspace etc. I prefer to add frameworks manually and feel I have more control over things that way. – Kashif Mar 24 '16 at 13:44

3 Answers3

1

If you are writing this in swift (its in your tags) you'll need to create a Bridging Header file to be able to expose the Objective C library to your swift code, importing the objective c library in the bridging header fie. Here's a guide on how to do this

Hope this solves your issue.

Daniel Ormeño
  • 2,743
  • 2
  • 25
  • 30
  • But how come Firebase library works without bridging? It is also written in ObjC – Kashif Mar 23 '16 at 23:27
  • I can only asume that you are not referencing it from your swift code, hence there's no need for it =) – Daniel Ormeño Mar 23 '16 at 23:30
  • Eventually I had to do bridging header as you says and of course it works then. I guess there is some difference between Firebase and GeoFire frameworks after all. – Kashif Mar 24 '16 at 13:43
  • @Kashif Can you provide the code for your bridge please? I've got the same problem but when I import GeoFire Framework, I don't get the prompt to create the bridge file. Thanks – Septronic Dec 30 '16 at 15:08
  • @Septronic: `#ifndef Bridge_h #define Bridge_h #import "GeoFire.h" #import "Firebase.h" #endif` – Kashif Dec 30 '16 at 15:10
  • @Kashif Thanks for the code. Did you use the framework that GeoFire project builds? I cloned the GeoFire git, and inside there is an xcode project. When you build the framework target, it creates a framework. I then imported the framework, but xcode is not recognising it. I tried using your code as well as importing the headers as #import but still I get the same error. – Septronic Dec 30 '16 at 15:14
  • @Septronic: Make sure your bridge is properly configured in build settings and -ObJC linker flag exists there. This mostly happens when the bridge path is not being recognized. – Kashif Dec 30 '16 at 15:46
  • @Kashif Thanks for the help. That didn't work either, but I ended up importing the entire GeoFire folder (without compiling it into a framework), and thanks to Xcode (importing the files separately finally prompted me to create the bridge for them), and changing the #import <....> in the imported files to #import "..." finally got everything working. I will create this as an issue in the git at some point. If you think it's a good idea to post my finding as an answer here, let me know and I'll do it :) Thanks again. – Septronic Dec 30 '16 at 17:02
1

Try do it: https://youtu.be/009UrLVlAbo?t=67 but just change the import header file like this:

#import <Firebase/Firebase.h>
#import <GeoFire/GeoFire.h>
Pedro Trujillo
  • 1,559
  • 18
  • 19
0

On XCode 7.2, with Swift, and ran into this same issue when mixing Firebase and Google Analytics pods.

Firebase alone works fine with "use_frameworks!" in the Podfile, but Google Analytics pod install needs that line commented out. So bridging header file is needed.

drakest1
  • 1
  • 2