문제

If I use the UIDataDetectorTypePhoneNumber on a UITextView, and click a phone number on a device that has no phone (e.g. iPad), I get a Send Message / Add to Contacts / Copy popover. Is there some way to bring up that dialog directly in code or would I have to reimplement?

I did try [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:5555555"]]; but that does not bring up the dialog.

There are some subtle differences between how detected links and buttons behave and my client wants a clickable phone number that behaves like a button.

도움이 되었습니까?

해결책

I did some method swizzling to see where this popover comes from, and it looks like it is generated before the openURL: method in UIApplication.

Digging further, it looks like the popover comes from some private objects in UITextView.

I think you'll have to reimplement.

attached backtrace

다른 팁

Did you try it with some forward slashes?

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://5555555"]];

Possibly related to this.

Use telprompt://5555555 instead of tel:5555555

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top