收到推送通知后如何拨打电话?

发布于 2024-10-13 06:27:01 字数 102 浏览 1 评论 0原文

我开发了一个预约应用程序。当我收到推送通知时,我想给特定的人打电话,但现在我只是在收到推送通知时打开应用程序。

当我收到特定约会的推送通知时,如何编写代码来拨打该约会的电话?

I have developed an appointment application. When I receive a push notification, I want to make a call to a particular person, but right now it is just opening the application when I get a push notification.

How do I write a code to make a call to a particular appointment as I get the push notification of that appointment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伊面 2024-10-20 06:27:01

对于推送通知,您必须在 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"]]]];
    }

For push notification you have to code in appDelegate,

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",[userInfo valueForKey:@"phno"]]]];
}

For local notification,

    -(void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
    {
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",[notification.userInfo valueForKey:@"phno"]]]];
    }
柠檬心 2024-10-20 06:27:01

收到通知后,使用给定的电话号码打开拨号器应用程序。注意:这将首先启动您的应用程序,然后快速切换到拨号器。

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://5555555555"]];
}

Upon notification, open the dialer app with the given phone number. Note: this will initially launch your app, then quickly switch to the dialer.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://5555555555"]];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文