gpt4 book ai didi

iphone - 注册多个远程通知类型时出错

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:20:29 26 4
gpt4 key购买 nike

当我注册多种通知类型时,XCode 快把我逼疯了:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge]; 

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

它抛出错误而不是警告:

error: Semantic Issue: Cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int'

即使这是每个人都使用的同一条线(甚至是 Apple 在他们的演示中)。我正在使用 iOS 5 SDK(第一个在 iOS 5 发布后出现的)和 XCode 4.2。该项目是一个较旧的项目(XCode 3 和 iOS 4),正在升级并针对 iOS 5。

最佳答案

我也遇到过这个问题。诀窍是如果此代码位于 .mm 文件(Objective C++)中,则会发生此错误。如果您没有使用任何 C++ 功能,请将文件扩展名从 .mm 更改为 .m,它将编译正常。

关于iphone - 注册多个远程通知类型时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8015790/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com