PSMenuItem icon indicating copy to clipboard operation
PSMenuItem copied to clipboard

Project no longer compiles by default on iOS8

Open andreasmpet opened this issue 10 years ago • 11 comments

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)

andreasmpet avatar Mar 20 '15 12:03 andreasmpet

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.

steipete avatar Mar 20 '15 14:03 steipete

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

andreasmpet avatar Mar 20 '15 15:03 andreasmpet

So, what you're saying is that the UIViewController I'm presenting this from must still implement - canBecomeFirstResponder { return YES; }

andreasmpet avatar Mar 20 '15 15:03 andreasmpet

yep!

steipete avatar Mar 20 '15 15:03 steipete

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?

andreasmpet avatar Mar 23 '15 12:03 andreasmpet

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!

andreasmpet avatar Mar 23 '15 12:03 andreasmpet

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!

andreasmpet avatar Mar 23 '15 12:03 andreasmpet

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.

steipete avatar Mar 23 '15 12:03 steipete

Is it safe to use this project on iOS 8 now?

mrmarcsmith avatar Apr 22 '15 09:04 mrmarcsmith

We use this in PSPDFKit all the time, works fine.

steipete avatar Apr 22 '15 10:04 steipete

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.

andreasmpet avatar Apr 23 '15 12:04 andreasmpet