How can I make phone call in iOS?

后端 未结 8 2333
不思量自难忘°
不思量自难忘° 2020-12-07 23:05

How can I make a phone call in Objective-C?

相关标签:
8条回答
  • 2020-12-07 23:42

    well if you are talking about using objective-c to make a phone call on the iphone, then you can do something like this:

    NSURL *phoneNumber = [[NSURL alloc] initWithString: @"tel:867-5309"];
    [[UIApplication sharedApplication] openURL: phoneNumber];
    

    If you are talking about doing this on a mac ,well, then like others have mentioned that is specific based on number of things like, if you are using voip, a modem, connecting through something like an Asterisks box, etc..

    0 讨论(0)
  • 2020-12-07 23:43

    This is clipped from a project I did to do just that:

    NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",phone_number];
    NSURL *phoneURL = [NSURL URLWithString:phoneStr];
    [[UIApplication sharedApplication] openURL:phoneURL];
    
    0 讨论(0)
提交回复
热议问题