如何从Apple手表拨打电话?

时间:2015-01-01 12:11:56

标签: ios phone-call watchkit

有没有办法从WatchKit分机拨打电话?

以下是我的代码。

NSExtensionContext *ctx = [[NSExtensionContext alloc] init];
NSString *cleanedString = [[@"1234567890" componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789-+()"] invertedSet]] componentsJoinedByString:@""];
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", cleanedString]];
[ctx openURL:telURL completionHandler:^(BOOL success) {
    NSLog(@"fun=%s after completion. success=%d", __func__, success);
}];

0 个答案:

没有答案