带有检测电话号码 IOS 9 的 TextView 错误 [英] Error on TextView with detection phone number IOS 9

查看:26
本文介绍了带有检测电话号码 IOS 9 的 TextView 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 iOS 9 的 iPod Touch 上测试我的应用程序(在 iOS 8.4 上,它适用于其他功能:FaceTime、复制到联系人等).我有一个带有电话号码检测功能的文本视图,但收到以下错误:

I'm testing my app on an iPod Touch running iOS 9 (on iOS 8.4 it was working for other functions: FaceTime, copy to contacts, etc.). I have a textview with phone number detection and I receive the following error:

警告:尝试呈现 <_UIRotatingAlertController: 0x16250e00> 其视图不在窗口层次结构中!

Warning: Attempt to present <_UIRotatingAlertController: 0x16250e00> on whose view is not in the window hierarchy!

断言失败 -[UITextView startInteractionWithLinkAtPoint:],/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UITextView_LinkInteraction.m:377

Assertion failure in -[UITextView startInteractionWithLinkAtPoint:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UITextView_LinkInteraction.m:377

有什么解决办法吗?

推荐答案

不是一个完美的解决方案,但非常简单,可以帮助绝望的开发人员:

Not a perfect solution but very simple and may help a desperate developer:

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
    [[UIApplication sharedApplication] openURL:URL];

    return NO;
}

长按您将丢失复制、打开 URL、取消弹出框,但您至少应该能够像以前一样打开 url.在 iOS 9 中,这仍然会在您的应用中打开一个浏览器窗口,用于显示标准 URL(这很好).

You will lose the Copy, Open URL, Cancel popover on long press but you SHOULD at least be able to open url same as you would previously. In iOS 9, this still opens a browser window inside your app for standard URLs (which is nice).

这似乎是 Apple 的错误(已发布到雷达).

This seems like an Apple bug (posted to radar already).

我们在尝试在模态视图中打开链接时看到了非常相似的错误,因为 Apple 正在尝试显示新的模态警报视图.模式视图之外的数据检测在 iOS 9 中对我们来说效果很好.

We were seeing very similar error when trying to open links in a modal view since Apple is trying to display a new modal alert view. Outside of modal view data detection worked just fine in iOS 9 for us.

这篇关于带有检测电话号码 IOS 9 的 TextView 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆