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

Fixes Issue #375 #376

Closed markrickert closed 10 years ago

markrickert commented 10 years ago

Some of the UIActivityType constants are iOS 7.0+ only.

@marocchino can you pull this branch down and run bundle exec rake spec target=6.1 to make sure? I don't have the iOS 6 simulator installed on my machine at this moment.

marocchino commented 10 years ago

Thank you for your PR. But It seems to be still not working.

$ bundle exec rake spec target=6.1
  WARNING! BubbleWrap::HTTP is deprecated and will be removed, see https://github.com/rubymotion/BubbleWrap/issues/308
  WARNING! Switch to a different networking library soon - consider AFNetworking: http://afnetworking.com/
  WARNING! You can use the 'bubble-wrap-http' gem if you need compatibility: https://github.com/rubymotion/BubbleWrap-HTTP
     Build ./build/iPhoneSimulator-6.1-Development
...
dyld: Symbol not found: _UIActivityTypeAddToReadingList
  Referenced from: /Users/user/Library/Application Support/iPhone Simulator/6.1/Applications/SOMENUMBER/testSuite_spec.app/testSuite
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit
 in /Users/marocchino/Library/Application Support/iPhone Simulator/6.1/Applications/SOMENUMBER/testSuite_spec.app/testSuite
markrickert commented 10 years ago

Hmm... I'm getting ERROR! It is not possible to simulate an SDK version (6.1) lower than the app's deployment target (7.1)

Did you modify the Rakefile to support iOS 6?

markrickert commented 10 years ago

OK, I added app.deployment_target = "6.1" to the Rakefile at line 35 to get this working.

I think I have a solution. It's not pretty, but it gets around the issue of constants not being available to the 6.1 compiler.

Pull down that last commit i just made and let me know if this is working for you now.

clayallsopp commented 10 years ago

any updates @marocchino ?

marocchino commented 10 years ago

Sorry, I almost forgot it. As I remember, this patch is not working in iOS7. I will add detail fail message later.

marocchino commented 10 years ago
$ bundle exec rake spec target=7.1
NameError: uninitialized constant Kernel::UIActivityTypeAddToReadingList
    constants.rb:41:in `get:': BubbleWrap::UIActivityViewController - Sets multiple excluded activities
    constants.rb:33:in `get:'
    ui_activity_view_controller_wrapper.rb:17:in `new:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant Kernel::UIActivityTypeAirDrop
    constants.rb:41:in `get:': .get - should return an array of string constant values
    constants.rb:32:in `get:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

742 specifications (934 requirements), 0 failures, 2 errors

$ bundle exec rake spec target=7.0
...
NameError: uninitialized constant Kernel::UIActivityTypeAddToReadingList
    constants.rb:41:in `get:': BubbleWrap::UIActivityViewController - Sets multiple excluded activities
    constants.rb:33:in `get:'
    ui_activity_view_controller_wrapper.rb:17:in `new:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant Kernel::UIActivityTypeAirDrop
    constants.rb:41:in `get:': .get - should return an array of string constant values
    constants.rb:32:in `get:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

742 specifications (934 requirements), 0 failures, 2 errors

$ bundle exec rake spec target=6.1
NameError: uninitialized constant Kernel::UIActivityTypeAddToReadingList
    constants.rb:41:in `get:': BubbleWrap::UIActivityViewController - Sets multiple excluded activities
    constants.rb:33:in `block in get:'
    constants.rb:33:in `get:'
    ui_activity_view_controller_wrapper.rb:17:in `new:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant BubbleWrap::UIViewWrapper::UIScreenEdgePanGestureRecognizer
    ui_view_wrapper.rb:24:in `when_screen_edge_panned:': gestures - returns a gesture recognizer
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant BubbleWrap::UIViewWrapper::UIScreenEdgePanGestureRecognizer
    ui_view_wrapper.rb:24:in `when_screen_edge_panned:': gestures - enables interaction when called
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant BubbleWrap::UIViewWrapper::UIScreenEdgePanGestureRecognizer
    ui_view_wrapper.rb:24:in `when_screen_edge_panned:': gestures - doesn't enable interaction if asked not to
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

NameError: uninitialized constant Kernel::UIActivityTypeAirDrop
    constants.rb:41:in `get:': .get - should return an array of string constant values
    constants.rb:32:in `get:'
    spec.rb:316:in `block in run_spec_block'
    spec.rb:440:in `execute_block'
    spec.rb:316:in `run_spec_block'
    spec.rb:331:in `run'

742 specifications (931 requirements), 0 failures, 5 errors
clayallsopp commented 10 years ago

@markrickert you'll probably have to do something like create ui_activity_view_controller_wrapper.rb and ui_activity_view_controller_wrapper_ios7.rb, and only compile the ios7 version if the deployment target is > 6.1?

markrickert commented 10 years ago

Ok @marocchino, can you test it again? I think i've got it this time. I'm conditionally requiring a file with the iOS 7 constants only if the app.deployment_target is set to 7.0 or higher.

I'm building on ios 7.1 with RubyMotion 2.29 and i get

745 specifications (943 requirements), 0 failures, 0 errors
markrickert commented 10 years ago

@clayallsopp Is there something else i have to do to get the osx build to run properly? I keep getting this error... presumably because the test suite is requiring all files by default?

2014-06-09 12:40:24.090 testSuite[1701:303] uninitialized constant UIActivityViewController (NameError)
2014-06-09 12:40:24.094 testSuite[1701:303] *** Terminating app due to uncaught exception 'NameError', reason: 'uninitialized constant UIActivityViewController (NameError)
clayallsopp commented 10 years ago

You should be running bundle exec rake spec osx=true locally

markrickert commented 10 years ago

WOHOO! Fixed!

sajoku commented 10 years ago

I seem to be running into this issue with RubyMotion 2.30 and bubble-wrap 1.6.0. Any idea when this pull-request is going to get merged and a new version released?

clayallsopp commented 10 years ago

@sajoku it is done: https://github.com/rubymotion/BubbleWrap/releases/tag/v1.7.0

sajoku commented 10 years ago

@clayallsopp thanks!

sajoku commented 10 years ago

Sorry for the late reaction but I'm still experiencing a problem with UIActivityTypeAddToReadingList on iOS 6.1 (Simulator). I'm not really able to pinpoint where this comes from. I see this when I upgrade BW 1.6.0 to 1.7.0. This happens after bundle exec rake spec target=6.1

dyld: Symbol not found: _UIActivityTypeAddToReadingList
clayallsopp commented 10 years ago

@sajoku have you run that after running rake clean:all?

clayallsopp commented 10 years ago

@sajoku Nevermind, I found the problem. The check for deployment_target happened whenever BubbleWrap was required, which almost always happen before a user configures their app and changes the deployment_target

Can you try using BubbleWrap from the git repo now? I tried it locally using bundle exec rake spec target=6.1 and it works

sajoku commented 10 years ago

Yea! It works. Thanks @clayallsopp

moomerman commented 10 years ago

@clayallsopp fyi: just hit the same problem with 1.7.0, using master worked

clayallsopp commented 10 years ago

I've pushed 1.7.1 to RubyGems: https://github.com/rubymotion/BubbleWrap/releases/tag/v1.7.1