如何打开按下按钮时打开的呼叫/拨号号码视图?
enter code here-(IBAction)Call:(id)sender{
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://18005551234"]];
/*NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phoneNumber.text];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
[phoneURL release];
[phoneStr release];*/
NSURL *url = [ [ NSURL alloc ] initWithString: @"tel:212-555-1234" ];
[[UIApplication sharedApplication] openURL:url];
} 在上面的代码中,我使用了多种方法,但没有人工作。当我在函数上实现断点时,它说这超出了范围。这有什么问题吗?
enter code here-(IBAction)Call:(id)sender{
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://18005551234"]];
/*NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phoneNumber.text];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
[phoneURL release];
[phoneStr release];*/
NSURL *url = [ [ NSURL alloc ] initWithString: @"tel:212-555-1234" ];
[[UIApplication sharedApplication] openURL:url];
}
in above code i use various method but no one working. when i implement a break-point on function then it say this is out of scope. what is problem in this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该删除电话号码中的连字符“-”以及方括号“(”、“)”。除数字外不应有特殊字符。
You should remove the hypens "-", and also the brackets "(", ")" from the phone number. No special characters should be there except numbers.