1
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];
}在上面的代碼 我使用各種方法,但沒有一個人工作。當我在函數上實現一個斷點時,它說這是超出範圍。這是什麼問題?如何打開通話製作/撥號NUMER視圖中打開時,按下按鈕?
哪一個是正確的選擇? – ram
您可以根據需要使用任何方法。如果手機號碼是動態的,你可以把它放在一個單獨的變量,並使用* stringWithFormat追加它:*方法。 – EmptyStack
哪一個更好?在模擬器中的任何一項工作。請寫下正在使用的代碼行。 – ram