Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 通过watchkit应用程序进行电话呼叫_Ios_Objective C_Watchkit - Fatal编程技术网

Ios 通过watchkit应用程序进行电话呼叫

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 =

我试图在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];
按钮按预期显示,处理程序也会使用正确的电话号码进行呼叫。但它并没有打开系统URL。有人知道为什么以及如何修复吗?谢谢