Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

iphone - Open in + UIDocumentInteractionController : how to filter options in SDK iOS 6 (canPerformActions is deprecated)

Since the new SDK was release (iOS 6), the delegate method documentInteractionController:canPerformAction: of the UIDocumentInteractionControllerDelegate is deprecated.

Using that method you were able to prevent default actions like print: and copy: to appear.

The method is being called in the current version of iOS 6, but in future versions this method will not be called and my app will show actions that I don't want to support.

I read the available documentation for the UIDocumentInteractionController and its delegate and I'm not able to find a another way to do what I do in the canPerformAction method.

Any ideas?

As a plus, it would be great to be able to filter apps like mail or twitter (that appears by default) but I guess that this is not possible.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Agreed on the fact that deprecating 'canPerformAction' in the delegate is troublesome, we lost the fine grain control we used to have.

However, if all you want is to allow a document to be opened in another app, and wanted to remove Copy, Print and even Mail, I guess you are better off using OpenIn version of method to present the UIDocumentInteractionController?

i.e. for your UIDocumentInteractionController use presentOpenInMenuFromBarButtonItem:animated: or presentOpenInMenuFromRect:inView:animated:

(instead of presentOptionsMenuFromBarButtonItem:animated: or presentOptionsMenuFromRect:inView:animated:)

This way, by default, it will only show apps that can open your document, and hides Mail, Copy and Print.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...