Domanda

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.

È stato utile?

Soluzione

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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top