我已经开发了预约申请。当我收到推送通知时,我想打电话给某个人,但是现在它只是在我收到推送通知时打开应用程序。
当我获得该约会的推送通知时,如何编写代码以调用特定约会?
答案 0 :(得分:3)
对于推送通知,您必须在appDelegate中编码,
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",[userInfo valueForKey:@"phno"]]]];
}
对于本地通知,
-(void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",[notification.userInfo valueForKey:@"phno"]]]];
}
答案 1 :(得分:2)
收到通知后,打开带有给定电话号码的拨号器应用程序。注意:这将首先启动您的应用,然后快速切换到拨号器。
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://5555555555"]];
}