ios - 隐藏 PayPal MPL 的 UiAlert

标签 ios objective-c paypal uialertview paypal-adaptive-payments

我正在使用 PayPal MPL iOS 库。每当我按下取消按钮时,都会显示一条警告消息。如何防止 UiAlert 出现? paypal alert

最佳答案

似乎 Paypal 库本身正在设置警报 View 。因此,除非 paypal 库中有禁用该功能的内容,否则您可能无法直接禁用它。可能有一些解决方法,以下是我的想法:

通过 NSNotification 中心显示新的 UIWindow 时收听通知。通知列在文档底部。

https://developer.apple.com/library/ios/documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html

这是另一篇关于收听通知的文章。

Is there a notification on iOS if a UIAlertView is shown?

我的想法是,也许您可​​以在显示警报 View 时捕捉到您可以通过在 AppDelegates 窗口对象上调用 makeKeyAndVisible 来撤消它

[[UIApplication sharedApplication].delegate.window makeKeyAndVisible];

另一个想法对我来说似乎完全是 hack,所以我不会提倡或证明使用方法调配。如果您调整了 UIAlertView 的 [show] 函数,那么您可以注入(inject)一个简单的 if 语句来决定是否调用真正的 show 方法,从而有效地决定是否真正显示警报。走这条路可能会产生无法预料的后果。如果您不熟悉 NSHipster 的技术,请参阅文章 http://nshipster.com/method-swizzling/ .在走这条路之前,我会考虑禁用警报的必要性。

关于ios - 隐藏 PayPal MPL 的 UiAlert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24420994/

相关文章:

paypal - 坚持集成 Paypal Express Checkout(基本集成 checkout.js 版本 4.0.0)

ios - NSString componentsSeparatedByString "&"但忽略 "& amp;"

ios - 尝试制作一个平台,让我可以从下面跳过去,但可以降落在上面。难以微调逻辑

ios - 如果应用程序已关闭并且我收到推送通知,如何检测通知上的点击并转到特定 Controller ?

ios - 字典与一堆 "if"和 "return"

c# - 将 PaymentDetailsItemType 数组传递给 PayPalAPI

ios - 将 iOS 应用程序从 Xcode 上传到 Browserstack

ios - 无法检索设备位置

背景中的 iPhone/iPod 按钮剪切到 UIAlertView TextBox

PayPal 按钮 IPN 处理