在徽标调整中显示UIAlertView或UIView控制器



我正在为iOS 6.1附带的默认MobileSMS应用程序上的SMS发送进行调整。即使我已经设法挂上了"发送"按钮,我也无法创建一个弹出窗口来通知用户,无论是UIAlertView还是UIViewController。我认为问题是我钩接到的CTMmsEncoder类没有视图控制器可以以某种方式覆盖。

我的问题是,是否有某种方法可以使视图在这种情况下出现。我已经浏览了许多源代码进行调整,但找不到类似的情况。我什至尝试创建一个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() ,即使在您没有适当的视图层次结构的情况下也是如此。

看到肯尼TM的这个答案,或者我在这里发布的另一个答案......跳到"从守护程序通知用户"部分的第 (2) 项。