iOS 4.2 - Return to app after phone call

前端 未结 6 1722
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 22:56

I can successfully initiate a phone call within my app using the following:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@\"tel://12345678         


        
6条回答
  •  难免孤独
    2020-11-29 23:53

    I have given this answer in iPhone SDK: Launching an app after call ends I will also post my code here.. here you can make a call without closing you app..

    -(IBAction) dialNumber:(id)sender{
    
    NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];
     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];
    }
    
    
    }
    

提交回复
热议问题