我正在为 iOS 6.1 附带的默认 MobileSMS 应用程序上的 SMS 发送进行调整。即使我已成功连接到“发送”按钮,但我无法创建弹出窗口来通知用户,无论是使用 UIAlertView
还是使用 UIViewController
。我认为问题在于我连接的 CTMmsEncoder 类没有 View Controller 来以某种方式覆盖。
我的问题是是否有某种方法可以使 View 出现在这种情况下。我已经检查了许多源代码进行调整,但找不到类似的案例。我什至尝试创建一个 dylib 并从那里加载 UIViewController,但收到(预期的)错误:
Oct 25 14:37:59 Pudge SpringBoard[950] <Warning>: Warning: Attempt to present <ModalViewController: 0x1dbbe1a0> on <KSMSDylibViewOne: 0x1db7da50> whose view is not in the window hierarchy!
当尝试直接在我的调整中实现带有 ViewController 的类(例如 ModalViewController 类)时,Theos 显然会输出错误:
Tweak.xm:12:6: error: instance method 'presentViewController:animated:completion:' is being used on 'Class' which is not in the root class
[-Werror,-Wobjc-method-access]
[self presentViewController:view animated:YES completion:nil];
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
有什么办法可以克服这个问题,还是我必须重新设计?
提前谢谢您,
帕纳吉奥蒂斯。
最佳答案
如果您只是想创建类似于 UIAlertView
的内容,您应该能够使用 CFUserNotificationCreate()
,即使在您不这样做的情况下没有正确的 View 层次结构。
查看此answer by KennyTM ,或另一个 I posted here ...跳到从守护程序通知用户部分,第 (2) 项。
关于ios - 在 Logo 调整中显示 UIAlertView 或 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19589924/