0

だから私は番号を呼び出すアプリケーションを作成します:

NSString *cleanedString = [[number componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789-+()"] invertedSet]] componentsJoinedByString:@""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", escapedPhoneNumber]];
UIWebView *mCallWebview = [[UIWebView alloc] init]  ;
[self.view addSubview:mCallWebview];
[mCallWebview loadRequest:[NSURLRequest requestWithURL:telURL]];

ただし、iPhone 5 を使用しているテスターは、メインでは正常に動作しているのに、彼の電話では動作しないと報告しています。彼はクラッシュなどはありません。

ありがとう!

4

3 に答える 3

2
  NSString *number = YOUR-NUMBER;       
  NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@",number]];

  [[UIApplication sharedApplication] openURL:url];

このコードを試してみてください。通話が終了した後、アプリに戻ります

于 2013-01-28T11:37:59.730 に答える
1

tel:コードで URL スキーマが正しく使用されていません。//

NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", escapedPhoneNumber]];
于 2013-01-28T11:14:16.733 に答える
0

このコードを確認できます。これがお役に立てば幸いです。

NSString *phoneNo = @"your phone no";
NSString *strAppend  = [@"tel:" stringByAppendingString:phoneNo];
[[UIApplication sharedApplication]
  openURL:[NSURL URLWithString:strAppend]];
于 2013-01-28T12:03:02.050 に答える