slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

RubyMotion compatibility #90

Closed chrise86 closed 9 years ago

chrise86 commented 9 years ago

I’m trying to use https://github.com/slackhq/SlackTextViewController/ in a RubyMotion app, my controller overrides the init method with the following to use the table version:

def init
  super.initWithTableViewStyle UITableViewStylePlain
  self
end

But as soon as the controller is pushed, the app crashes with the following, using rake debug=1:

* thread #1: tid = 0x141ea6, 0x00000001011bacc1 libobjc.A.dylib`class_getSuperclass + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xb00000794)
  * frame #0: 0x00000001011bacc1 libobjc.A.dylib`class_getSuperclass + 11
    frame #1: 0x00000001007279d6 TestApp`rb_objc_convert_immediate + 118
    frame #2: 0x00000001000eb925 TestApp`vm_ocval_to_rval + 165
    frame #3: 0x0000000100164df0 TestApp`__unnamed_5 + 32
    frame #4: 0x00000001000905f7 TestApp`-[SLKTypingIndicatorView indicatorLabel](self=0x0000000116e74050, _cmd=<unavailable>) + 61 at SLKTypingIndicatorView.m:88
    frame #5: 0x0000000100090547 TestApp`-[SLKTypingIndicatorView commonInit](self=0x0000000116e74050, _cmd=<unavailable>) + 232 at SLKTypingIndicatorView.m:63
    frame #6: 0x000000010009040b TestApp`-[SLKTypingIndicatorView init](self=<unavailable>, _cmd=<unavailable>) + 64 at SLKTypingIndicatorView.m:40
    frame #7: 0x0000000100087f33 TestApp`-[SLKTextViewController typingIndicatorView](self=0x000000011426acd0, _cmd=<unavailable>) + 53 at SLKTextViewController.m:300
    frame #8: 0x0000000100087540 TestApp`-[SLKTextViewController loadView](self=0x000000011426acd0, _cmd=<unavailable>) + 254 at SLKTextViewController.m:156
    frame #9: 0x00000001017ffce9 UIKit`-[UIViewController loadViewIfRequired] + 75
    frame #10: 0x000000010180017e UIKit`-[UIViewController view] + 27
    frame #11: 0x00000001018239f7 UIKit`-[UINavigationController _startCustomTransition:] + 633
    frame #12: 0x000000010182f8ee UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 386
    frame #13: 0x0000000101830437 UIKit`-[UINavigationController __viewWillLayoutSubviews] + 43
    frame #14: 0x0000000101975799 UIKit`-[UILayoutContainerView layoutSubviews] + 202
    frame #15: 0x0000000113f2fa5e UIKit`-[UILayoutContainerViewAccessibility layoutSubviews] + 43
    frame #16: 0x0000000101753f23 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    frame #17: 0x000000010385dde8 QuartzCore`-[CALayer layoutSublayers] + 150
    frame #18: 0x0000000103852a0e QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
    frame #19: 0x000000010385287e QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
    frame #20: 0x00000001037c063e QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242
    frame #21: 0x00000001037c174a QuartzCore`CA::Transaction::commit() + 390
    frame #22: 0x00000001037c1db5 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 89
    frame #23: 0x00000001045ffdc7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    frame #24: 0x00000001045ffd20 CoreFoundation`__CFRunLoopDoObservers + 368
    frame #25: 0x00000001045f5b53 CoreFoundation`__CFRunLoopRun + 1123
    frame #26: 0x00000001045f5486 CoreFoundation`CFRunLoopRunSpecific + 470
    frame #27: 0x000000010631b9f0 GraphicsServices`GSEventRunModal + 161
    frame #28: 0x00000001016da9d0 UIKit`UIApplicationMain + 1282
    frame #29: 0x00000001000efcd5 TestApp`main(argc=1, argv=0x00007fff5fbfe110) + 117 at main.mm:15
    frame #30: 0x00000001059cb145 libdyld.dylib`start + 1
(lldb)

The class SLKTypingIndicatorView at line 88 is:

- (UILabel *)indicatorLabel
{
    if (!_indicatorLabel)
    {
        _indicatorLabel = [UILabel new]; // this is line 88
        _indicatorLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _indicatorLabel.font = [UIFont systemFontOfSize:12.0];
        _indicatorLabel.textColor =[UIColor grayColor];
        _indicatorLabel.backgroundColor = [UIColor clearColor];
        _indicatorLabel.userInteractionEnabled = NO;
    }
    return _indicatorLabel;
}

Do you have any idea what it could be?

dzenbot commented 9 years ago

Sorry, I wouldn't know. We don't use RubyMotion ourselves. This is not an issue while compiling natively.

All those _cmd=<unavailable> messages are a bit scary. I wonder what they are about. Also this self=<unavailable>

I wonder if it's a RubyMotion incompatibility. Have you found any workarounds?

chrise86 commented 9 years ago

Haven't found anything :( had to give up given my current timeframe for what I'm doing :-/

cbx commented 9 years ago

I ran into the same issue and found that when using the sugarcube gem in your Rubymotion app there is a problem with [UILable new] pre version 3.3.1 - see also https://github.com/rubymotion/sugarcube/issues/172. Upgrading the sugarcube gem to 3.3.1 fixes this.

dgilperez commented 9 years ago

Hey @chrise86 could you please share some bits regarding how to start playing with such integration?

I just installed the SlackTextViewController using motion-cocoapods, but I just can't figure out how to actually go and load the controller.

Thanks!

chrise86 commented 9 years ago

@dgilperez I pretty much just took the example here and converted to RubyMotion syntax

dgilperez commented 9 years ago

@chrise86 thanks! I happen to have some problem compiling / linking the library with Xcode 5.1.1, but 6.0 seems to be OK.