我正在向我的应用程序添加 PushKit 通知,并偶然发现了上述错误。
我做了什么:
- 启用推送通知
- 在后台模式下启用远程通知
- 添加了链接框架 PushKit.framework
我用 PKPushRegistryDelegate 扩展了我的 AppDelegate 并实现了 pushRegistry 方法:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, forType type: PKPushType) {
}
.
.
.
一切似乎都很好,但是当我构建时出现错误:
No type or protocol named PKPushRegistryDelegate
在这种情况下,我还尝试了扩展,但出现了不同的错误:
Cannot find protocol declaration for 'PKPushRegistryDelegate'
我猜有些东西不见了,但找不到什么。谁能帮我?
ps 我正在使用 xcode 9 和 swift 4