Make calls from the iPhone app

Possible duplicate:
make a call to iphone from my application

I want to call the specified number from my iPhone application. Could you suggest a good tutorial that explains this best or tells me the process?

+3
source share
5 answers
NSString* phoneNumber=TextFiled Name
    NSString *number = [NSString stringWithFormat:@"%@",phoneNumber];
    NSURL* callUrl=[NSURL URLWithString:[NSString   stringWithFormat:@"tel:%@",number]];

        //check  Call Function available only in iphone
    if([[UIApplication sharedApplication] canOpenURL:callUrl])
    {
        [[UIApplication sharedApplication] openURL:callUrl];
    }
    else
    {
        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"ALERT" message:@"This function is only available on the iPhone"  delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
                          [alert show];
                         [alert release];
                    }    
    }
+6
source

You can try:

NSURL *phoneNumberURL = [NSURL URLWithString:@"tel:80001212"];
[[UIApplication sharedApplication] openURL:phoneNumberURL];
+9
source

: -

    NSString *phoneNumber = @"15555551212";
    NSString *dtmfAfterPickup = @"1234";

    NSString *telString = [NSString stringWithFormat:@"tel:%@,%@", phoneNumber, dtmfAfterPickup];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
+1

iOS " URL". URL-, , . - , (, iPad, ), , , :


if([[UIApplication sharedApplication] canOpenURL:myURL]) {
  [[UIApplication sharedApplication] openURL:myURL];
} else {
  // do something else, e.g. inform the user that he/she cannot open the app
}

, . , , URL- . : .

URL- Apple : http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html#//apple_ref/doc/uid/TP40007893-SW1 , URL- : http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html#//apple_ref/doc/uid/TP40007893-SW1

, - handleOpenURL, URL- . , URL, , , .

0

: -

1) [[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "tel: // 9912345678"]];

2) You can use UITextViewand enable phone detection. After that, the phone number will look like a hyperlink. Use the following code.

mytextview.text = @"9943586256";
mytextview.dataDetectorTypes = UIDataDetectorTypePhoneNumber;
mytextview.editable=NO;

Useful if you want to show the phone number inside the user cell of the table.

I would really like the second one because of the requirements in some project. When I give the phone number in UITextViewand when pressed, which will start the call.

0
source

Source: https://habr.com/ru/post/1757617/


All Articles