iphone - how to open call making /dailing numer view open whenbutton press? -



iphone - how to open call making /dailing numer view open whenbutton press? -

enter code here-(ibaction)call:(id)sender{ //[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"tel://18005551234"]]; /*nsstring *phonestr = [[nsstring alloc] initwithformat:@"tel:%@",phonenumber.text]; nsurl *phoneurl = [[nsurl alloc] initwithstring:phonestr]; [[uiapplication sharedapplication] openurl:phoneurl]; [phoneurl release]; [phonestr release];*/ nsurl *url = [ [ nsurl alloc ] initwithstring: @"tel:212-555-1234" ]; [[uiapplication sharedapplication] openurl:url];

} in above code utilize various method no 1 working. when implement break-point on function out of scope. problem in this?

you should remove hypens "-", , brackets "(", ")" phone number. no special characters should there except numbers.

nscharacterset *specialcharset = [nscharacterset charactersetwithcharactersinstring:@" )(-,"]; nsarray *components = [phonenumber.text componentsseparatedbycharactersinset:specialcharset]; nsstring *phonestr = [components componentsjoinedbystring:@""]; phonestr = [nsstring stringwithformat:@"tel:%@", phonestr]; nsurl *url = [[nsurl alloc] initwithstring:phonestr]; [[uiapplication sharedapplication] openurl:url];

iphone objective-c ios xcode uibutton

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -