Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing when using Pod, working fine if copied to project. #8

Open
rasmuslp opened this issue Jan 6, 2014 · 8 comments
Open

Crashing when using Pod, working fine if copied to project. #8

rasmuslp opened this issue Jan 6, 2014 · 8 comments

Comments

@rasmuslp
Copy link

rasmuslp commented Jan 6, 2014

Fair warning: I'm new to Obj-C and all that it entails.

I have made a minimum example here using CocoaPods: https://github.com/rasmuslp/AXStatusItemPopupCrash
Just download zip, open workspace, build/run, and press on cloud in menubar.
For me, this stalls on line 161:

        [_popover showRelativeToRect:self.frame ofView:self preferredEdge:NSMinYEdge];

With the message

2014-01-06 21:30:40.791 AXStatusItemPopupCrash[12696:303] -[NSLock view]: unrecognized selector sent to instance 0x6000000deca0
2014-01-06 21:30:40.792 AXStatusItemPopupCrash[12696:303] -[NSLock view]: unrecognized selector sent to instance 0x6000000deca0
2014-01-06 21:30:40.795 AXStatusItemPopupCrash[12696:303] (
    0   CoreFoundation                      0x00007fff8d71b41c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff880f1e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8d71e2ed -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff8d6795b2 ___forwarding___ + 1010
    4   CoreFoundation                      0x00007fff8d679138 _CF_forwarding_prep_0 + 120
    5   AppKit                              0x00007fff926b83a2 -[NSPopover showRelativeToRect:ofView:preferredEdge:] + 172
    6   AXStatusItemPopupCrash              0x0000000100001d61 -[AXStatusItemPopup showPopoverAnimated:] + 513
    7   AXStatusItemPopupCrash              0x0000000100001b57 -[AXStatusItemPopup showPopover] + 55
    8   AXStatusItemPopupCrash              0x0000000100001655 -[AXStatusItemPopup mouseDown:] + 101
    9   AppKit                              0x00007fff92614d9a forwardMethod + 122
    10  AppKit                              0x00007fff92697373 -[NSControl mouseDown:] + 1080
    11  AppKit                              0x00007fff92618d08 -[NSWindow sendEvent:] + 11296
    12  AppKit                              0x00007fff9271411b -[NSStatusBarWindow sendEvent:] + 247
    13  AppKit                              0x00007fff92a8b461 -[NSStatusItemReplicant _retargetEvent:fromWindow:] + 765
    14  AppKit                              0x00007fff927140f5 -[NSStatusBarWindow sendEvent:] + 209
    15  AppKit                              0x00007fff925b7744 -[NSApplication sendEvent:] + 2021
    16  AppKit                              0x00007fff92407a29 -[NSApplication run] + 646
    17  AppKit                              0x00007fff923f2803 NSApplicationMain + 940
    18  AXStatusItemPopupCrash              0x0000000100001042 main + 34
    19  libdyld.dylib                       0x00007fff88ff75fd start + 1
)

Sometimes, instead of NSLock, I get the error on the runloop queue:

2014-01-06 21:32:41.093 AXStatusItemPopupCrash[12776:303] -[OS_dispatch_queue_runloop view]: unrecognized selector sent to instance 0x6080000ca100
<snip>

If I remove the Pod of AXStatusItemPopup, and add the two files to the root group of the project, then it works like expected. Hence, it seems to be related to the podspec or a consequence thereof.

Any idea whats going on here ?

@rasmuslp
Copy link
Author

rasmuslp commented Jan 6, 2014

Obviously, the error is that 'view' is called on e.g. an NSLock. The question I cannot answer is why.

@Arcnor
Copy link

Arcnor commented Jan 24, 2014

I'm having the same problem (thanks rasmuslp BTW, I'd never think of that :D). Works fine when copying, but not with Cocoapods. Any idea why?

@rasmuslp
Copy link
Author

No, unfortunately not. I just begun on my Obj-C adventure, and hence doesn't have much experience yet. For now I just copied the files to the project, although I do expect to get it solved some day and use Cocoa Pods instead.

@aschuch
Copy link
Owner

aschuch commented Mar 23, 2014

Are you using version 0.0.2?

@rasmuslp
Copy link
Author

Yes, this was with 0.0.2.

@chrisjdavis
Copy link

Just wanted to chime in and say I am seeing the same thing. I haven't had time to diagnose yet since I am working against a deadline, but hope to look into the issue later.

@wlcx
Copy link

wlcx commented May 12, 2014

Yup, same thing here using latest HEAD

@hk0i
Copy link

hk0i commented Aug 31, 2014

Hmm... I had crashing too when using the pod... I moved the following code into the main initWithViewController: method and it works fine.

    _popover = [[NSPopover alloc] init];
    _popover.contentViewController = _viewController;

here's a diff, not sure if that helps

--- a/Pods/AXStatusItemPopup/AXStatusItemPopup/AXStatusItemPopup.m
+++ b/Pods/AXStatusItemPopup/AXStatusItemPopup/AXStatusItemPopup.m
@@ -59,6 +59,9 @@

         _active = NO;
         _animated = YES;
+
+        _popover = [[NSPopover alloc] init];
+        _popover.contentViewController = _viewController;
     }
     return self;
 }
@@ -150,11 +153,6 @@
 - (void)showPopoverAnimated:(BOOL)animated
 {
     self.active = YES;
-
-    if (!_popover) {
-        _popover = [[NSPopover alloc] init];
-        _popover.contentViewController = _viewController;
-    }

     if (!_popover.isShown) {
         _popover.animates = animated;

my guess is that _viewController is being released or reassigned before it's ever used (??)
I'm not too familiar with OS X desktop dev yet though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants