我有这个代码:
NSString *telURL = [NSString stringWithFormat:@"tel:1-%@",((UIButton*) sender).titleLabel.text];
telURL = [telURL stringByReplacingOccurrencesOfString:@"\n" withString:@""];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telURL]];
Run Code Online (Sandbox Code Playgroud)
但它没有启动拨号器应用程序拨打电话.
我检查了字符串telURL,其内容是:"tel:[删除]",据我所知,这是它需要的.
有任何想法吗?
编辑:如果它很重要我刚刚在模拟器上运行它.几天我不会有物理设备.(从下面的答案显然它确实很重要)