Make a call from my iPhone application

后端 未结 3 1151
天命终不由人
天命终不由人 2021-01-06 03:38

I have implemented the ability to make a call from clicking on a row of descriptive tableview of my hotel; I used the URL scheme by writing the following code in method \"di

3条回答
  •  误落风尘
    2021-01-06 04:30

    Try this useful code

    Remove spaces for your code

    NSString *trimmedString = [yourNumberString stringByReplacingOccurrencesOfString:@" " withString:@""];
    

    Code for Call after confirmation

    NSString *phoneNumber = [@"telprompt://" stringByAppendingString:trimmedString];
    

    Code for direct calling

    NSString *phoneNumber = [@"tel://" stringByAppendingString:trimmedString];
    NSLog(@"Number : %@",phoneNumber);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
    

提交回复
热议问题