Return to app behavior after phone call different in native code than UIWebView

后端 未结 4 1215
感情败类
感情败类 2020-11-27 04:19

According to Apple\'s documentation, in order to make phone call from my app, I need to implement the following protocols:

HTML link:



        
4条回答
  •  春和景丽
    2020-11-27 04:50

    1. Behavior does differ between calling -[UIApplication openURL:] with a tel: URL, and clicking a link to the same URL in a UIWebView.

    2. 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.

    For example:

    #import 
    #import 
    
    @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
    

提交回复
热议问题