Intiate call from apple watch

I am developing an apple watch extension for an already existing application.

My watch application has contact us section where customer can call toll free number.

My question is how can i start call in apple watch on click of button rather than keeping my application in foreground and starting the call.

Currently i am using this code to start call

+ (void)callWithNumberWithoutPrompt:(NSString *)phoneNo {
    NSString *prefixedMobileNumber = [phoneNo hasPrefix:@"+"]?phoneNo:[NSString stringWithFormat:@"+%@",phoneNo];
    NSString *phoneNumber = [@"tel://" stringByAppendingString:prefixedMobileNumber];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
}

Please let me know if my question is not clear.

Thanks in advance.


Source: ios

Leave a Reply