ios - canOpenURL succeed but openURL fails, for tel as urlschema -
my app this:
user enters phone number in 1 textfield. app saves it. displays phone number in detail screen has "call" button. call canopenurl
method , if succeeds, keep call button enabled, otherwise keep disabled.
i creating url format : tel:phone number
.
now, 1 of tester added phone number = '55'. now, when calling canopenurl
, getting success, when call openurl
method, not showing popup phone number.
this 1 working fine other phone numbers, 2 digit phone numbers = 13, specific phone numbers 55,56 getting failed.
note: per client's requirement, dont have put validation on phone number, must have n number of characters or so. so, please dont provide answers this. required reason why canopenurl getting success , openurl getting failed.
the function canopenurl
check if schema valid, i.e. there app installed handle url. not resource valid, in case, number
is valid. see https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl
the problem 55 being invalid - see - caused specification of tel
urlscheme in rfc 2806. copied relevant parts:
telephone-url = telephone-scheme ":" telephone-subscriber telephone-scheme = "tel" telephone-subscriber = global-phone-number / local-phone-number global-phone-number = "+" base-phone-number [isdn-subaddress] [post-dial] *(area-specifier / service-provider / future-extension) base-phone-number = 1*phonedigit local-phone-number = 1*(phonedigit / dtmf-digit / pause-character) [isdn-subaddress] [post-dial] area-specifier *(area-specifier / service-provider / future-extension) ... area-specifier = ";" phone-context-tag "=" phone-context-ident
as read ebfn, telephone-subscriper
starts either +
or 1
character.
further on, in 2.5.2 phone numbers , scope
, rfc says:
if <local-phone-number> used, <area-specifier> must included well.
in opinion, reason why tel:55 fails, tel:13 ok.
Comments
Post a Comment