rubymotion-community / BubbleWrap

Cocoa wrappers and helpers for RubyMotion (Ruby for iOS and OS X) - Making Cocoa APIs more Ruby like, one API at a time. Fork away and send your pull requests
Other
1.18k stars 208 forks source link

Bubblewrap doesn't play nicely with cdq #374

Closed buffpojken closed 10 years ago

buffpojken commented 10 years ago

I've ran into an issue where bubblewrap doesn't place nicely with cdq (https://github.com/infinitered/cdq).

The bug appears when having a class which shares name with an internal class in bubblewrap, in this case "Player" and which is also subclassing from CDQManagedObject (wrapper around NSManagedObject).

For some reason, the non-library class "Player" will at some point become confused with the Media::Player-class, and Media::Player will become the reference for the global identifier "Player". The result being that since Player is no longer a subclass of NSManagedObject, it can't be saved (of course) and things break in spectacular ways.

A test-project manifesting the bug can be found at https://github.com/buffpojken/cdq-player-test and can be verified by toggling comment on #4 in Rakefile ("require 'bubble-wrap/all'"). The bug will appear when including bubble-wrap, and will disappear when bubble-wrap is not included. I have verified this by naming classes after other internal classes in BubbleWrap with the same result.

Testing was done on RubyMotion 2.26, on OS X 10.9.2, Build 13C64.

Since I'm unsure about where this issue lies, I've opened a corresponding issue with cdq at https://github.com/infinitered/cdq/issues/21

clayallsopp commented 10 years ago

Almost positive that this is a RubyMotion-level bug, and I've seen similar things happen before. Throw them a ticket with motion support and point them to your test repo

Until they fix it, a workaround is to rename your Player class

buffpojken commented 10 years ago

Roger that, will do!

Thanks!

matthewsinclair commented 10 years ago

For what it's worth, I saw exactly the same thing yesterday, but with a clash in the BubbleWrap::Location class. In my case, the app just dies cold, without a peep. I only found it by adding my model classes and entity definition back in one by one.