从iOS 6 SDK构建的应用程序中排除AirDrop和添加到阅读列表 [英] Exclude AirDrop and Add to Reading List from apps build with iOS 6 SDK
问题描述
我的iOS 6应用程序中有一个 UIActivityViewController
,我正在推动更新,但我还没有使用iOS 7 SDK进行编译。
I have a UIActivityViewController
in my iOS 6 app, I am pushing an update but I'm not yet compiling it with iOS 7 SDK.
有没有办法在iOS7中的 UIActivityViewController
中禁用添加到阅读列表和AirDrop而无需使用iOS 7 SDK重新编译?
Is there any way to disable Add to Reading List and AirDrop in my UIActivityViewController
in iOS7 without recompiling with iOS 7 SDK?
推荐答案
excludedActivityTypes
是iOS 6.0及更高版本中的有效属性,因此您可以利用它。您需要的常量( UIActivityTypeAddToReadingList
和 UIActivityTypeAirDrop
)不可用,因此您可以使用它们的文字值(大多数)可能与变量名称相同),直到你使用iOS 7 SDK重新编译(我建议你这样做。不太可能Apple改变一个常量值,但使用变量而不是文字更好的编程习惯)。我想这些值在iOS 6.x中会被忽略而不会引起任何问题,因为任何 UIActivity
都可以定义自己的名称,因此系统无法验证给定的类型。它很可能只是将它们添加到内部忽略列表中。
excludedActivityTypes
is a valid property in iOS 6.0 and above, so you can leverage that. The constants you need (UIActivityTypeAddToReadingList
and UIActivityTypeAirDrop
) are not available so what you can do is use their literal values (most likely the same as the variable name) until you recompile with the iOS 7 SDK (Which I suggest you do. It is not likely that Apple would change a constant value but it is better programming practice to use the variable instead of its literal). I imagine these values would be ignored in iOS 6.x and not cause any problems since any UIActivity
can define its own name so the system has no way of validating a given type. It most likely will just add them to an internal ignore list.
这篇关于从iOS 6 SDK构建的应用程序中排除AirDrop和添加到阅读列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!