Uzair Dhada
Uzair Dhada

Reputation: 333

Unable to open dialer when user clicks on the button in xcode 7

-(IBAction)didSelectButton:(id)sender
{
   NSString *numberString = @"415-592-5909";
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",numberString]]];
}

I have this code to open the dialer, but it doesn't work in Xcode 7. So when i searched i got that i have to whitelist the tel url scheme, so i did something like this in info.plist

<key> LSApplicationQueriesSchemes</key>
<array>
    <string>telprompt</string>
    <string>tel</string>
</array> 

Upvotes: 0

Views: 2722

Answers (1)

Ashish Kakkad
Ashish Kakkad

Reputation: 23882

You have added one Space before the key

<key> LSApplicationQueriesSchemes</key>

update it with

<key>LSApplicationQueriesSchemes</key>

Hope you are getting following error :

Terminating app due to uncaught exception 'InvalidOperationException', reason: 'tel is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0'

Just update the key with :

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>telprompt</string>
    <string>tel</string>
</array> 

And to open the prompt you have to use telprompt

Upvotes: 2

Related Questions