在 iPhone 上以编程方式拨打电话并在挂断后返回到同一个应用程序

发布于 2024-09-07 18:17:37 字数 63 浏览 2 评论 0原文

我会撒谎在我的应用程序中拨打电话(我可以使用电话:),但我想在用户挂断电话后返回到我离开的应用程序。 这可能吗?

I would lie to place a call in my app (I can use the tel:) but I would like to return to my app where I left after the users hangs up.
Is that possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南城追梦 2024-09-14 18:17:37

我从苹果网站获得了这段代码,它运行得很好:

-(IBAction) dialNumber:(id)sender{

NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];

NSString *osVersion = [[UIDevice currentDevice] systemVersion];

if ([osVersion floatValue] >= 3.1) { 
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
[webview loadRequest:[NSURLRequest requestWithURL:url]]; 
webview.hidden = YES; 
// Assume we are in a view controller and have access to self.view 
[self.view addSubview:webview]; 
[webview release]; 
} else { 
// On 3.0 and below, dial as usual 
[[UIApplication sharedApplication] openURL: url];
}


}

I got this code from Apple site and it works perfectly:

-(IBAction) dialNumber:(id)sender{

NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];

NSString *osVersion = [[UIDevice currentDevice] systemVersion];

if ([osVersion floatValue] >= 3.1) { 
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
[webview loadRequest:[NSURLRequest requestWithURL:url]]; 
webview.hidden = YES; 
// Assume we are in a view controller and have access to self.view 
[self.view addSubview:webview]; 
[webview release]; 
} else { 
// On 3.0 and below, dial as usual 
[[UIApplication sharedApplication] openURL: url];
}


}
感情废物 2024-09-14 18:17:37

不,不是。恐怕用户在电话结束后控制他们导航的位置。默认情况下,它保留在电话应用程序中,用户退出该应用程序的唯一方法是点击主页按钮,这会将他们带到主屏幕。保存您的状态,并在他们像其他人一样回来时重新加载它。

No it's not. The user controls where they navigate after the phone call has ended I'm afraid. by default, it stays in the phone application, and the only way for the user to exit out of it is to hit the home button, which takes them to their main screen. Save your state, and reload it when they come back like everyone else.

他夏了夏天 2024-09-14 18:17:37

通话结束后,您无法自动返回应用程序,但如果您的应用程序支持 iOS 4,则其多任务处理功能(如果应用程序支持)可以将用户带回通话前离开的位置,此时该应用程序已重新启动。

如果您使用 iOS 3 或更早版本,您将需要自己手动保存应用程序的状态,然后在重新启动时将用户带回到该状态。

You cannot return to the app automatically, after the call completes, but if your app supports iOS 4, its multitasking features (if the app supports them) can bring the user back to the spot where he or she left off before the call, when the app is relaunched.

If you use iOS 3 or earlier, you will need to manually save the app's state yourself and then bring the user back to that state on relaunch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文