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 不同的电话后返回应用程序行为
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
