通过watchkit应用程序拨打电话

时间:2017-04-26 06:32:22

标签: ios objective-c watchkit

我试图在Apple Watch上向用户显示不同的电话号码,并且他点击一个电话号码警报应该出现。我会像这样做,但警报只是在没有通话动作的情况下被解雇:

NSMutableArray *tempArray = [[NSMutableArray alloc] initWithCapacity:0];
WKExtension *myExt = [WKExtension sharedExtension];
for (NSString *phone in arr) {
    NSString *tel = [NSString stringWithFormat:@"tel:%@",phone];
    WKAlertAction *act = [WKAlertAction actionWithTitle:tel style:WKAlertActionStyleDefault handler:^(void){
        [myExt openSystemURL:[NSURL URLWithString:phone1]];
    }];
    [tempArray addObject:act];
}

NSString *titleMessage = @"Call";
NSString *textMessage = @"Please select the number you want to call.";
NSString *cancel = @"Cancel";

WKAlertAction *act = [WKAlertAction actionWithTitle:cancel style:WKAlertActionStyleDestructive handler:^(void){

}];
[tempArray addObject:act];

[Self presentAlertControllerWithTitle: titleMessage message: textMessage preferredStyle: WKAlertControllerStyleAlert actions: temporary];

按钮按预期显示,并且还使用正确的电话号码调用处理程序。但它没有openSystemURL。有人知道为什么以及如何解决?谢谢!

0 个答案:

没有答案