当用户重新与苹果签约时,我正在尝试发送通知。
我有三部分:
扩展Notification.Name {静态let userSignedIn = NSNotification.Name(rawValue:"userSignedIn") }
如果让userIdentifier = UserDefaults.standard.object(forKey:"appleSignIn")作为?(字符串){ let authorizationProvider = ASAuthorizationAppleIDProvider() ASAuthorizationAppleIDProvider userIdentifier) {(状态,错误)在开关(状态){ case .authorized: print(“帐户查找-签名”) DispatchQueue.main.async {NotificationCenter.default.post(名称:.userSignedIn,对象: nil) }破坏大小写.revoked: print(“没有帐户找到”)通过case .notFound: print(“没有找到帐户”)( ") DispatchQueue.main.async {}默认: break } }
NotificationCenter.default.addObserver(self, selector: #selector(profileLaunch(_:)), name: .userSignedIn, object: nil)
我不知道通知是没有被张贴,还是观察者没有被调用。谢谢!
发布于 2021-01-27 06:12:02
可能是!委托不是set.Hope,在这里您可以得到答案-> didReceiveRemoteNotification not called, iOS 10
https://stackoverflow.com/questions/65913149
复制相似问题