Ios 通过watchkit应用程序进行电话呼叫
我试图在Apple Watch上向用户显示不同的电话号码,他点击了一个,而不是应该显示的电话提醒。我会这样做,但警报只是在不采取行动的情况下解除:Ios 通过watchkit应用程序进行电话呼叫,ios,objective-c,watchkit,Ios,Objective C,Watchkit,我试图在Apple Watch上向用户显示不同的电话号码,他点击了一个,而不是应该显示的电话提醒。我会这样做,但警报只是在不采取行动的情况下解除: NSMutableArray *tempArray = [[NSMutableArray alloc] initWithCapacity:0]; WKExtension *myExt = [WKExtension sharedExtension]; for (NSString *phone in arr) { NSString *tel =
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];
按钮按预期显示,处理程序也会使用正确的电话号码进行呼叫。但它并没有打开系统URL。有人知道为什么以及如何修复吗?谢谢