iphone - 在通话结束时启动应用程序

时间:2010-09-30 12:59:32

标签: iphone

是否可以在电话结束时或发送短信后启动应用程序?

3 个答案:

答案 0 :(得分:1)

这根本不可能。因为您无法在呼叫结束或发送消息时获得事件。所以你无法打开应用程序。

快乐编码......

答案 1 :(得分:1)

我从Apple网站获得了此代码,它运行良好:

- (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];          
    }

    //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:aPhoneNo]];

}

答案 2 :(得分:0)

看起来可能有所帮助..

iPhone SDK: Launching an app after call ends