firebase / geofire-objc

GeoFire for Objective-C - Realtime location queries with Firebase
MIT License
436 stars 180 forks source link

Duplicate symbol for architecture i386. Geofire and motion-firebase #34

Closed theCrab closed 8 years ago

theCrab commented 8 years ago

@mcdonamp I am trying to use both of this libs in RubyMotion app. But overtime I install the GeoFire pod it creates conflicts. The version of Firebase that GeoFire supports is lower than what Motion-firebase supports and its creating the double symbol error. I don't want to nuke my dev machine for this. What can you do?

I have logged an issue on motion-firebase here https://github.com/colinta/motion-firebase/issues/25

asciimike commented 8 years ago

You should be able to use CocoaPods to install an arbitrary version. motion-firebase seems to be on 2.5.0, so you can just use pod 'Firebase', '= 2.5.0' to both be in lock step.

That said, I don't think that it's an issue with the versions being different, I think that because motion-firebase ships with a version of Firebase already included, pulling in a second version via CocoaPods will cause the duplicate symbol errors because there are literally two copies of Firebase (at any version) sitting around. I assume that the Pods .xcodeproj and whatever RubyMotion does are incompatible in this way.

I see two solutions:

  1. Install GeoFire.framework manually, assuming that you can pick up the import from the environment (I have no idea if motion-firebase will surface it's Objective-C dependencies--if you can do #import <Firebase/Firebase.h> you'll be good to go).
  2. Remove the Firebase.framework dependency from motion-firebase and install the dependencies yourself. Alternatively, make motion-firebase a Cocoapod, and have it somehow depend on the Firebase pod. I have no clue if this is possible, but both are Ruby, so there's a slim chance that things work out.
theCrab commented 8 years ago

OK. As commented on the other side. I have fixed this. Thank you so much for the help. Could I recommend GeoFire be separated from shipping a version of Firebase? That firebase be required instead of included? I have looked at a few Firebase libs and some ship with Firebase albeit different versions.

We can let dev's use whichever version is best suited for their needs. And update the Readme to point this out. Thanks @mcdonamp

What do you think?

asciimike commented 8 years ago

Currently Firebase is a required dependency, it's not bundled with GeoFire (per se). In order to get different versions of each, I think you can just write your Podfile as:

target 'Foo' do
  pod 'Firebase', '= X.Y.Z'
  pod 'Geofire', '= X.Y.Z'
end

And it will respect those version numbers. I may be wrong though.

The short answer is that in order for us to do this well, we would need CocoaPods to properly support something like NPM's peer dependencies. The other issue is that technically, GeoFire does have a hard dependency on Firebase--without Firebase, GeoFire can't do anything, so it makes sense to be a hard dependency. Also, in the default case, this solution "Just Works" and I'd be pretty hesitant to break something that works well to solve it in a case that's maybe 1% of its usage.

theCrab commented 8 years ago

Thanks @mcdonamp we solved it nicely.

In the examples SFViewController.m i want to circleQuery the centre of the mapView with a radius of 1km. I want to update the query when the user pans the map. I want to display only vehicles in the query circle with Events.

But I don't want to display the circle or if i do, i want it to be static. the user should not move it around. Im new to objective-c so am working slowly. How would you do this?

asciimike commented 8 years ago

@theCrab let's move this question to Stack Overflow, since it doesn't pertain to this issue and SO is generally a better medium for these questions.