firebase/geofire-objc

Geofire Cocoapod 2.0 Isn't Available

psopher opened this issue ยท 127 comments

Hi,

I'm just confused because the ReadMe says I can download the Geofire 2.0 Cocoapod, but when I try to do it, I get this message:

None of your spec sources contain a spec satisfying the dependency: GeoFire (~> 2.0).

And when I look at the page on the CocoaPod website, it says version 1.1.3 is the latest one.

Is this on purpose? When will the cocoapod be ready for this newest version of Geofire?

jwngr commented

The 2.0 branch just got merged in yesterday and we are still working on getting out the pod. Hang tight. It should be out later today.

@jwngr Looking forward to it!

Is this still being updated today? Sorry, but I have an app that relies on this.... @jwngr

Watching this, too! Glad this post was here...wasn't working for me!

Very excited for this...thank you!!!

jwngr commented

We are still working through some CocoaPods issues.

@greggmojica - There's a perfectly usable 1.1.3 version of the GeoFire CocoaPod that you can use. This should not be blocking your app.

It's an open source project as well, so folks are welcome to use it as a local spec--you're not even blocked on using the new version locally (or even shipping like this!)

pod 'GeoFire', :path => 'path/to/local/geofire/directory'

Running it locally gives me a build error saying "Module Firebase not found."

I'm a novice but the directions seem pretty straightforward. I'll wait for the cocoa pods, but just found it interesting I'm getting an error and you seem to be having trouble...

@jwngr Please let us know here when it is out. Do you think it will be out today?

If anyone else was having that "Firebase module not found issue" - in the two places it identified errors, I replaced "@import Firebase;" with the line suggested here, and it worked: http://stackoverflow.com/questions/37322473/firebase-module-install-on-ios#comment62164478_37322473

Really no reason to wait on this. Download it to your machine and use the "path" to point to it. I have 2.0 working fine. Whenever it hits cocoa pods, I'll just switch the line in the pod file.

Im having a error at "@import Firebase;" in Geofire.m

@mpcmarques See my post above...I was having trouble posting the exact line to change that to (twice) but the link I posted has it

@greggmojica Seriously, it is incredibly easy to install locally. I am an extreme(!) novice and I got it working. No reason to have any delay based on this. Download it, add the location of the folder to the pod file (using that "path" thing mentioned above), then (for me) fix that import error twice.

And I have 2.0 working.

I'm experiencing multiple errors with the "workaround". Really hoping we could get an official version out.


1st. Update the Podfile:

//...
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'
// ...

2nd. pod install
"Module 'Firebase' not found" error on the following files:

  • GeoFire.m
  • GFQuery.m

3rd. Replace @import Firebase; with #import <Firebase/Firebase.h>. This really shouldn't be the fix, since it reverts the instructions on Upgrade your iOS app from Firebase.com.
4th. Build issues:
screen shot 2016-06-12 at 12 46 10

@zgosalvez my path in the pod file is a local folder. I downloaded the zip of geofire, unzipped, and used the path for that folder. (Dragged onto the open pod file to get its full path.)

@mcmarshall Did it your way, still no cigar; shows the same issues I stated. Thanks for the tip anyway.

Is there a fix for this? I have the pods Firebase 3.2.1 and GeoFire 2.0.0 via git installed however I am getting errors in GeoFire.h and GFQuery.h saying Module 'Firebase' not found.

I have tried replacing @import Firebase with #import <Firebase/Firebase.h>, but this brings on more errors, the same errors that are in the screenshot from @zgosalvez

I use Firebase 3.2.1 from Cocoapods, and have GeoFire 2.0.0 working on Swift ! Just download GeoFire project from GitHub website, drag and drop GeoFire sources into my project and create a Bridging-Header to import "GeoFire.h", and all is working great ;)

Hey @fredericdnddev. What do you mean by "sources" specifically if you don't mind me asking? Also, in the bridging header, do you write #import <GeoFire/GeoFire.h>?

Hey @manticarodrigo, sorry, I mean the GeoFire folder containing the API and Implementation folders, and the .pch file. Drag the GeoFire folder into your project and select "Create groups" instead of "Create folder references", all the GeoFire files will be at the root of your project, so you can just import it in your bridging header with : #import "GeoFire.h"

And I forgot one thing, you'll got an error saying that 'GeoFire/GeoFire.h' file is not found, so just replace the #import line with that of your bridging header, because GeoFire.h is no longer in the GeoFire folder, but at the root of your project

You drag the entire "GeoFire" folder containing those things, or the contents inside the folder? I am still getting the "Use of unresolved identifier "GeoFire" warning.

1- drag the folder "GeoFire" into your project in Xcode
2- it will show you a pop-up "Choose options for adding theses files", select "Create groups" instead of "Create folder references"
3 - in your bridging-header, add the line #import "GeoFire.h"
4 - If you run your project know, you will get the error 'GeoFire/GeoFire.h' file not found, so click on the error, and in the displayed file, replace #import <GeoFire/GeoFire.h> with #import "GeoFire.h"

Have you added your Bridging-Header in Build Settings ?

Thank you! I'll let you know if it works when Game of Thrones is over!

No problem, good episode ;)

I hadn't added the bridging header to build settings. You're a life saver @fredericdnddev! Great episode btw.

Can Firebase get the cocoapod version working, please? I keep getting the same issues, and the solution posted by @fredericdnddev didn't work for me (a lot of other errors showed up regarding GeoFire.m). I'd very much like to use this framework!

cxt9 commented

I'm getting that while using the local path to the latest version I just downlaoded:

/iosprojects/project name/Pods/Headers/Private/Firebase/Firebase.h:1:9: 'FirebaseAnalytics/FirebaseAnalytics.h' file not found

I can't change the file (locked and can't unlock it) so no way to try and fix it.

Both of you, have you downloaded GeoFire from this link : https://github.com/firebase/geofire-objc/archive/master.zip ? And are you using the latest version of Firebase ? Update your pods through the terminal, and try installing GeoFire as I indicated

When can they just release the official pod to simplify this?

I did @fredericdnddev 's guide
1- Downloaded the geofire, and dragged/dropped the GeoFire folder (the folder with api and implementation folder) with "Create groups" (it's at Proj>SupportingFiles>GeoFire)
2- Create a bridging header (at Proj>SupportingFiles>Proj-Bridging-Header.h:

#ifndef Proj_Bridging_Header_h
#define Proj_Bridging_Header_h

#import "GeoFire.h"

#endif /* Proj_Bridging_Header_h */

3- In build settings, for obj-c bridging header, I added - Proj>Proj-Bridging-Header.h

I assume the path is correct, because if I try any other, it gives file not found error..

The errors I receive:
screen shot 2016-06-13 at 14 40 10

Remove ALL the GeoFire files and folders in your project directory (in Finder), and do it again

I can also say that i tried @fredericdnddev 's guide. no luck.
I get the same error that @zgosalvez shows in number 4 screen shot.
installed latest Firebase according to google's instructions as a new swift project, then tried the guide.
running Xcode 7.2.1

I tried to create a new project following my guide, but I got errors. I found the solution by adding pod 'Firebase/Database' to main PodFile. Have you added this line in your pod file ? If not, add it and relaunch your project

R E S P E C T !!!!
now it works. Thank you so much!!!!

You're welcome @werneroi ;)

I did everything you said.
Before I was using...

let geofireRef = Firebase(url: self.dataURL + "/userLocations")
let geoFire = GeoFire(firebaseRef: geofireRef)

Now, it gives me an error: "Cannot call value of non-functional type 'module '." What am I doing wrong ? :/

If you installed Firebase from Cocoapods, it is probably the version 3.X, so replace Firebase(url: self.dataURL + "/userLocations") with let geofireRef = FIRDatabase.database().referenceFromURL(self.dataURL + "/userLocations")

@fredericdnddev
Yes, it's 3.2.1 and that's why I tried:

        let ref = FIRDatabase.database().reference()
        let geofireRef = ref.child("userLocations")
        let geoFire = GeoFire(firebaseRef: geofireRef)

but still no luck :/

your constant geofireRef is no a GeoFire reference, but a Firebase Database reference

This is how I did it :

let ref = FIRDatabase.database().reference()
let geoFireRef = GeoFire(firebaseRef: ref.child("locations"))
geoFireRef.setLocation(location, forKey: "\(userID)")

But how can I convert FIRDatabaseReference to GeoFire reference? I couldn't figure out what is different between your bit and my bit.

let geoFire = GeoFire(firebaseRef: ref.child("userLocations")) ?

In your previous answer, you created your GeoFire ref with : let geofireRef = ref.child("userLocations")
But ref is equal to FIRDatabase.database().reference() so a Firebase Database reference. You need to create a GeoFire ref from a Firebase Database ref, so let geoFire = GeoFire(firebaseRef: ref.child("userLocations")) will works great

@fredericdnddev So this should work right?

let ref = FIRDatabase.database().reference()
let geoFire = GeoFire(firebaseRef: ref.child("userLocations"))

I think I am missing out something because it's still giving me error Argument passed to call that takes no arguments.
Did you spot what I am missing?

Your code works for me, so try to clean your projet (CMD + Shift + K), restart Xcode and see if the error is already here

I tried these. The error is still there. As I said, before, I was using GeoFire 1.3 through CocoaPod. To make the upgrade, I deleted the line in my podfile and run pod install. Is there a way maybe the old GeoFire from the pods persisted and not removed; thus it's causing the error? Is there a way to check it?

Sorry I don't know that, but have you installed GeoFire like I said ?

Yes I did. It's not complaining or anything for that. And I have import GeoFire at the top too.

Can you create a new project, install Firebase from Cocoapods and try to install GeoFire like I said ?

I figured out the problem. When I deleted pod GeoFire line from my podfile; and run pod install, it seemed like it was removed. However, weirdly, even though I use your way to add 2.0, and the GeoFire() becomes highlighted, if I cmd+click on GeoFire, it's going to a different GeoFire.h. I couldn't figure out where it is or how come it is referenced to somewhere else. On that GeoFire.h, the right panel is empty.

screen shot 2016-06-13 at 17 13 48

Is there references to GeoFire in your project directory in Finder ?

I've been trying but I couldn't figure out how to check it. How can I check if there is reference to another GeoFire? There is nothing else except the ones I dopped in my project directory

Create a project like a said and see if there is problem, if not, to me the only solution is to move your actual project into the new project where GeoFire is working

Cmd + Alt + Shift + K is the answer. @fredericdnddev Thanks a lot!

You're welcome ;)

I found a solution! Here is my PodFile, if anyone is interested:

pod 'Firebase'
pod 'Firebase/Database'
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

#49 solves the @import Firebase issue--sorry, I thought I merged this in Thursday before I left but I guess not :'(

I'm still working through CocoaPods issues with using Firebase in this manner (FirebaseUI and another third party library have both had this issue), so that's why this hasn't been pushed to CoocaPods yet. For now I think that what was suggested above will work:

pod 'Firebase/Database'
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

(and realistically, GeoFire has a dependency on Firebase/Database, so just GeoFire should be necessary since it'll pull in Firebase/Database which pulls in Firebase)

Thanks @mcdonamp ! Really appreciate the update!

Thank you! @mcdonamp

I'm getting Module 'FirebaseDatabase' not found.

Using Firebase (3.2.1)
Using FirebaseAnalytics (3.2.0)
Using FirebaseDatabase (3.0.1)
Using FirebaseInstanceID (1.0.6)
Using GeoFire (2.0.0)
Using GoogleInterchangeUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)

screen shot 2016-06-14 at 10 29 51 am

@Opelor Did you add pod Firebase/Database ? Can you please show your pod file?

@sentiasa Yes, I did.
screen shot 2016-06-14 at 10 53 00 am

Just remove Database : -> @import Firebase;

@fredericdnddev I already tried that. Did not work. Same error.

hey i had the same problem i did #import "Firebase/FIRDatabase.h" i think. give it a shot and let me know

@smilebot No, it didn't worked.

@Opelor I was messing around with it last night and got it to work. Try
#import "FirebaseDatabase/FIRDatabase.h"
or which ever folder the header file is in.

@smilebot 2 errors now.

screen shot 2016-06-14 at 3 12 30 pm

Here is the pod folder:
screen shot 2016-06-14 at 3 13 03 pm

well i don't think you need the module @import FirebaseDatabase if you are importing the file itself.

add #import "FirebaseDatabase/FIRDatabase.h" to the other two files and give it a shot.

@smilebot Thanks. It works now.

cxt9 commented

@Opelor - what worked for you? I can't get it to work either.

@cxt9 How doesn't it work?

For anyone experiencing FirebaseDatabase/FIRDatabase.h not found issue. Make sure to edit the target membership of FirebaseDatabase.framework to include GeoFire. See screenshot below for reference.

screen shot 2016-06-15 at 15 31 39

@cxt9 Replacing @import FirebaseDatabase for #import "FirebaseDatabase/FIRDatabase.h" in GFQuery.m and GeoFire.m worked for me.

But @zgosalvez solution to this problem is better.

what it worked for me was having in my Podfile this:
pod 'Firebase'
pod 'Firebase/Database'
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

And following the above advice from @zgosalvez

Any updates on the Cocoapod? Is it likely to be ready this week? @mcdonamp

@zgosalvez Your solution for editing the target membership for FirebaseDatabase.framework worked for me. In fact, I did not have to change @import FirebaseDatabase; to FirebaseDatabase/FIRDatabase.h for it to work.
I used pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git' to install GeoFire.

To update people--it's highly likely that the reason some people are successful, while others aren't, is that these methods work on CocoaPods 0.39, but don't work with 1.0. @jdimond was using 0.39, and I was using 1.0, without us realizing the other was doing it--I assume others on this thread and doing the same. Basically, Clang modules in 1.0 are either broken or "working as intended" which doesn't support iOS 7 (static libs wrapped by frameworks). I know that CocoaPods doesn't support iOS 7, so we'll have to get creative here :)

Dear @mcdonamp,
any news/updates regarding the Cocoapod issue? We haven't heard anything from you since 2 weeks. Or should we all try to do it with the workaround posted above?

Ok, so I realize there's a solution posted and I'm not complaining at all, but just out of curiosity, why hasn't this been updated on cocoapods yet?

To be perfectly honest, it's because we can't deploy it because there are still issues with us shipping a static lib wrapped as a framework. We need to ship Geofire as a zip archive and change the podspec (as we did for FirebaseUI), or we need to change the Firebase pod to be a dynamic framework; otherwise we just end up with more "transitive deps on static binaries" errors further down the road. I second the ๐Ÿ˜• emoji, but unfortunately we just haven't had time to fix the pod.

I want to thank everyone for their input! It helped me resolve my errors after struggling with this for 3 day!
I have Cocoapod 1.0 with Firebase 3.0

Here is how I got it to work.
I added Geofire 2.0 as follows:
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

I got the errors like everyone else, instead of #import "FirebaseDatabase/FIRDatabase.h" I entered #import "Firebase/Firebase.h" and added the target membership like @zgosalvez suggested to
FirebaseDatabase and for FirebaseAnalytics.

Hope this helps someone like me.

MarkGodo, thanks for the summary - it did indeed work for me (Cocoapod 1.0/Firebase 3.0) when I followed those steps.

I wanted to note that if you run "pod update" on the project the target membership will revert back to unchecked, so you will have to manually check it every time you do a clean install or anytime you run "pod update".

Does anybody have any insight into this issue using Swift? I know Geofire is supposed to be compatible with Swift, but the line:

pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

is still not solving any issues. Any help would be appreciated!

Frits-vp, what exactly is the problem? What error are you getting? Where in the process are you getting stuck? Please give some more information regarding the problem (and also regarding your setup such as Cocoapods version, Firebase version).

@netdawgx I'm using Firebase 3.0 and Geofire 2.0, as well as Cocoapods 1.0. The error i'm getting is that even when i'm installing the pod directly from Git to my project, import statements for Geofire still fail to recognise Geofire. In other words, when I install Geofire using the above line, I get the error "no such module 'Geofire'" when I try to import it.

Copy and paste your podfile?

On Jul 26, 2016, at 3:25 AM, frits-vp <notifications@github.commailto:notifications@github.com> wrote:

@netdawgxhttps://github.com/netdawgx I'm using Firebase 3.0 and Geofire 2.0, as well as Cocoapods 1.0. The error i'm getting is that even when i'm installing the pod directly from Git to my project, import statements for Geofire still fail to recognise Geofire. In other words, when I install Geofire using the above line, I get the error "no such module 'Geofire'" when I try to import it.

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com//issues/48#issuecomment-235183963, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABQ3nUV5PF5-xbpc_TFzRHHBULCtS6slks5qZbZ6gaJpZM4IzEGE.

@netdawgx here it is:

// Uncomment this line to define a global platform for your project
// platform :ios, '9.0'

target 'Test' do
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleMaps'

Comment this line if you're not using Swift and don't want to use dynamic frameworks

use_frameworks!

Pods for Test

pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Storage'

pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

target 'TestTests' do
inherit! :search_paths
# Pods for testing
end

target 'TestUITests' do
inherit! :search_paths
# Pods for testing
end

end

Hmm, So in XCode you're getting the no such module found- I would recommend trying the following until I can try to recreate your error tomorrow:

  1. Clean install. This has worked for me before with other Firebase components.
  2. Seems obvious but often times these errors are small oversights: make sure you are opening the .xcworkspace file and not the .xcodeproj file.

My Podfile's content, pod install runs well, but I get the 'Firebasedatabase/Firebasedatabase.h' file not found error in GeoFire.m

target 'DatabaseSample' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  #pod 'GeoFire', :path => 'custom-pods/geofire-objc'
  pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc'
  #pod 'Firebase', '2.5.1'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Database'

end
$ pod install
Analyzing dependencies
Downloading dependencies
Using Firebase (3.3.0)
Using FirebaseAnalytics (3.2.1)
Using FirebaseDatabase (3.0.2)
Using FirebaseInstanceID (1.0.7)
Using FirebaseRemoteConfig (1.1.1)
Using GeoFire (2.0.0)
Using GoogleIPhoneUtilities (1.2.1)
Using GoogleInterchangeUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 10 total pods installed.

I tried to search around, but cannot find a way to resolve it.

Hieuvo, to fix your problem you have to follow these steps:

On left side panel of XCode (Project Navigator) you have to navigate to:
Pods -> Pods -> FirebaseDatabase -> Frameworks -> FirebaseDatabase.framework

When you select FirebaseDatabase.framework look on the right side (Utilities panel) under File Inspector (the page icon with folder corner).

In the list under "Target Membership" check mark GeoFire.

Be aware if you ever clean install or run pod update on the project you will have to redo this step.

Here is a picture that @zgosalvez posted:
https://cloud.githubusercontent.com/assets/1798166/16071528/6e625fd8-330e-11e6-97ca-655bea333fbb.png

it works now, thanks @netdawgx

here's what i did.

  1. added following line into pod file and ran pod install
    pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'
  2. created an obj-c bridging header and added:
    #import "GeoFire/GeoFire.h"
  3. able to successfully create GeoFire and query from firebase

problem:
i was able to compile and run in the simulator without any problem but when i tried to load it up to an iPhone, i have got the error Command failed due to signal: Segmentation fault: 11
:0: error: unable to execute command: Segmentation fault: 11
:0: error: merge-module command failed due to signal (use -v to see invocation)

the current workaround is to set the Debug optimization level from NONE to WHOLE MODULE OPTIMIZATION. (set in the Targets build settings, swift complier - code generation). setting this option allows me to load it to the iPhone successfully. what causes the error?

@garrrrr23 have you updated cocoapods to 1.x? I saw the segfault a lot when I was using 0.39, but upgrading to 1.x seemed to solve the problem.

@mcdonamp mine is on COCOAPODS: 1.0.1

If anyone is interested, I got the module to run without doing anything else only with the following in my podfile. Here is an example:

platform :ios, '8.0'
use_frameworks!

abstract_target "MyTarget" do
  pod 'Firebase/Core'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'GeoFire', :git => 'git@github.com:firebase/geofire-objc.git'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'GeoFire' then
      target.build_configurations.each do |config|
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/"
        config.build_settings['OTHER_LDFLAGS'] = "#{config.build_settings['OTHER_LDFLAGS']} -framework FirebaseDatabase"
      end
    end
  end
end

This grabs the repo from github master and fixes the library to link with the appropriate firebase framework.

For anyone that has upgraded to Firebase 3.8.0, just take the example I have above and add the GoogleToolboxForMac directory to the framework search paths: config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/ $PODS_CONFIGURATION_BUILD_DIR/GoogleToolboxForMac"

So the full example for anyone on Firebase 3.8.0 should have something like this in their Podfile:

platform :ios, '8.0'
use_frameworks!

abstract_target "MyTarget" do
  pod 'Firebase/Core'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'GeoFire', :git => 'git@github.com:firebase/geofire-objc.git'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'GeoFire' then
      target.build_configurations.each do |config|
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/ $PODS_CONFIGURATION_BUILD_DIR/GoogleToolboxForMac"
        config.build_settings['OTHER_LDFLAGS'] = "#{config.build_settings['OTHER_LDFLAGS']} -framework FirebaseDatabase"
      end
    end
  end
end

Hope this helps anyone updating their podfile!

So I was able to get my project building with the above help, but I'm running into an issue where the enum GFEventType isn't recognized.

screen shot 2016-11-01 at 2 39 37 pm

I'm on Cocoapods 1.1.0, Firebase 3.8.0, and Geofire 2.0.0.

Any help would be appreciated!

In swift you can just use the enum names .KeyEntered and .KeyExited

@matijse Ahhhh silly me. Thank you so much!!!!