iOS 가 전 화 를 거 는 3 가지 실현 방식
방법 1.request WithURL,이 방법 은 전 화 를 걸 기 전에 알림 을 팝 업 합 니 다.
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"136****0000"];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:string]]];
[self.view addSubview:callWebview];
swift 코드:
let callWebview = UIWebView()callWebview.loadRequest(NSURLRequest(url: URL(string: "tel:136****0000")!) as URLRequest)
self.view.addSubview(callWebview)
방법 2.openURL(telprompt),이 방법 으로 전 화 를 걸 기 전에 알림 이 뜨 면 App Store 심사 에 통과 하지 못 할 수 있 습 니 다.
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"telprompt:%@",@"136****0000"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
swift 코드:방법 3.openURL(tel)을 이용 하여 iOS 10.2 이전에 탄 상 자 를 추가 하지 않 고 스스로 처리 해 야 하 며 수 동 으로 alert 를 추가 하면 됩 니 다.
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"136****0000"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
총결산위 에서 말 한 것 은 편집장 이 소개 한 iOS 가 전 화 를 걸 수 있 는 3 가지 실현 방식 입 니 다.여러분 에 게 도움 이 되 기 를 바 랍 니 다.궁금 한 점 이 있 으 시 면 저 에 게 메 시 지 를 남 겨 주세요.편집장 은 바로 답 해 드 리 겠 습 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Swift의 패스트 패스Objective-C를 대체하기 위해 만들어졌지만 Xcode는 Objective-C 런타임 라이브러리를 사용하기 때문에 Swift와 함께 C, C++ 및 Objective-C를 컴파일할 수 있습니다. Xcode는 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.