无法使用 int 类型的右值初始化 UIRemote NotificationType 类型的参数

发布于 2024-12-21 06:38:08 字数 355 浏览 3 评论 0原文

当我使用 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; 注册远程推送通知时,会出现错误,提示 cannotinitialize a parameter of type 'UIRemoteNotificationType' with an 'int' 类型的右值,有人知道为什么吗?谢谢。

我的项目环境:Xcode 4.2 + iOS 5。

When I use [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; to register remote push notificatioin, an error occurs saying cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int', does anybody know why? thank you.

My project's environment: Xcode 4.2 + iOS 5.

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

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

发布评论

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

评论(1

や三分注定 2024-12-28 06:38:08

您应该将其显式转换为 UIRemoteNotificationType

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

You should cast it explicitly to UIRemoteNotificationType

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文