【发布时间】:2010-09-30 12:59:31
【问题描述】:
是否可以在通话结束或发送短信后启动应用程序?
【问题讨论】:
标签: iphone
是否可以在通话结束或发送短信后启动应用程序?
【问题讨论】:
标签: iphone
NO 这根本不可能。因为通话结束或发送消息时您无法获取事件。所以你无法打开应用程序。
快乐编码...
【讨论】:
我从 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]];
}
【讨论】:
看起来可能会有所帮助..
【讨论】: