PSMenuItem
PSMenuItem copied to clipboard
Project no longer compiles by default on iOS8
Hello! The project no longer compiles by default no iOS8.
Here are some changes I did to make it compile:
((void(*)(id, SEL, NSInvocation*))objc_msgSend)(_self, forwardInvocationSEL, invocation);
return ((NSMethodSignature *(*)(id, SEL, SEL))objc_msgSend)(_self, methodSignatureSEL, selector);
After getting it to compile, it still doesn't seem to work. The UIMenuController would still ask the active UIViewController for canPerformAction:sender: and canBecomeFirstResponder:. (I did remember to install the handler)
Hmm. We still use it in iOS 8 and it works (I did the changes as above in PSPDFKit).
The view controller needs to be first responder though.
Hm, maybe I'm just using it wrong.
Here's a pastebin of my class. It's a helper that will automatically pop up a menu item when the clipboard value has changed since last time the menu was shown.
http://pastebin.com/FfSFRV4Y
So, what you're saying is that the UIViewController I'm presenting this from must still implement - canBecomeFirstResponder { return YES; }
yep!
Btw, it would be nice if the compilation errors were fixed in the public CocoaPod. Can you do it, or should I submit a PR?
I made it work, but I had to register the class of the UIViewController with [PSMenuItem installMenuHandlerForObject:myViewController]; which seems to contradict your sample in the "How to Use" section of the readme, where you register the handler for a variable called "button". That lead me to believe that any object could be the menu handler.
Sorry for the nagging, thanks a lot for this useful repo!
Haha, I found I was using the wrong version of your repo. Cocoapods.org reports version 0.0.1 as the latest version, but your podspec says 1.0.0.
Double-oops!
Ah, never cared much about CocoaPods since we don't have any use for it at PSPDFKit... If you make a PR that fixes this I'll merge and re-tag it.
Is it safe to use this project on iOS 8 now?
We use this in PSPDFKit all the time, works fine.
It works, just have to make sure you point to the right version when using cocoapods
On Wed, Apr 22, 2015, 11:56 mrmarcsmith [email protected] wrote:
Is it safe to use this project on iOS 8 now?
— Reply to this email directly or view it on GitHub https://github.com/steipete/PSMenuItem/issues/6#issuecomment-95105918.