我試圖啓動從我的iPhone應用程序的調用返回後,返回到應用程序,我做到了follwing方式..從iPhone應用程序撥打電話編程和結束通話
-(IBAction) call:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Call Besito" message:@"\n\n\n"
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex != [alertView cancelButtonIndex])
{
NSString *phone_number = @"0911234567"; // assing dynamically from your code
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone_number]]];
NSString *phone_number = @"09008934848";
NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
[phoneURL release];
[phoneStr release];
}
}
由以上代碼.. 我能夠成功撥打電話..但是當我結束通話時,我無法返回到我的應用程序
因此,我想知道如何實現,也請告訴我如何使用webview發起呼叫...
謝謝& Registers Ranjit
這個問題詳細解答你的問題。只需使用uiwebview來調用,而不是openURL:http://stackoverflow.com/questions/5317783/return-to-app-behavior-after-phone-call-different-in-native-code-than-uiwebview –