Return to app behavior after phone call different in native code than UIWebView(在本机代码中与 UIWebView 不同的电话后返回应用程序行为)
问题描述
根据Apple 的文档,按顺序要从我的应用拨打电话,我需要实现以下协议:
According to Apple's documentation, in order to make phone call from my app, I need to implement the following protocols:
HTML 链接:
<a href="tel:1-408-555-5555">1-408-555-5555</a>
本机应用程序 URL 字符串:
tel:1-408-555-5555
但是,在完成从 UIWebView 内的 HTML 链接发起的电话呼叫后,我会被重定向回我的应用程序.但是,在通过本机应用程序 URL 字符串完成电话呼叫后,我的 iphone 会停留在 iphone 的常规电话应用程序中,如果我想返回我的应用程序,我必须手动执行此操作.
However, upon completion of a phone call initiated from an HTML link inside a UIWebView, I am redirected right back to my application. But upon completion of a phone call made from a native application URL string, my iphone stays in the iphone's regular phone application, and if I want to return to my application I have to do so manually.
据我阅读其他人所说的,我无法改变这种行为.
As far as I can tell from reading what others have said, there is no way to change this behavior.
这是我的问题:
- 真的不可能吗之后返回应用程序从本地人打来电话应用程序 URL 字符串?
- 会有什么缺点吗实现 UIWebView 而不是一个 UILabel 在我的情况下真的希望用户成为重定向回我的应用程序打完电话后?
推荐答案
使用
tel:
URL 调用-[UIApplication openURL:]
和单击中指向相同 URL 的链接之间的行为确实不同UIWebView
.
Behavior does differ between calling
-[UIApplication openURL:]
with atel:
URL, and clicking a link to the same URL in aUIWebView
.
使用 UIWebView
而不是 UILabel 可能有一些缺点,但您不必实际显示 UIWebView
来获取它的 tel
URL 处理行为.相反,只需在 UIWebView 实例中加载 tel
URL 请求,而不将其添加到您的视图层次结构中.
Using a UIWebView
instead of a UILabel might have some downsides, but you don't have to actually display the UIWebView
to get its tel
URL handling behavior. Instead, just load a tel
URL request in an instance of UIWebView without adding it to your view hierarchy.
例如:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface PhoneCaller : NSObject
{
@private
UIWebView *webview;
}
- (void)callTelURL:(NSURL *)url;
@end
@implementation
- (id)init
{
self = [super init];
if (self)
{
webview = [[UIWebView alloc] init];
}
return self;
}
- (void)callTelURL:(NSURL *)url
{
[webview loadRequest:[NSURLRequest requestWithURL:url]];
}
- (void)dealloc
{
[webview release];
[super dealloc];
}
@end
这篇关于在本机代码中与 UIWebView 不同的电话后返回应用程序行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在本机代码中与 UIWebView 不同的电话后返回应用程序行为


- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- URL编码Swift iOS 2022-01-01
- UITextView 内容插图 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01