ios - Firebase通知不起作用ios
<p><p>我在我的应用中集成了 Firebase 推送通知。在 xcode 中启用了通知。证书也可以。但通知没有显示在我的应用程序中。有人对此有任何想法吗?</p>
<p>这是我的代码:</p>
<pre><code>;
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
UIUserNotificationType allNotificationTypes =
(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
UIUserNotificationSettings *settings =
;
[ registerUserNotificationSettings:settings];
} else {
// iOS 10 or later
#if defined(__IPHONE_10_0) && IPHONE_OS_VERSION_MAX_ALLOWED >= IPHONE_10_0
UNAuthorizationOptions authOptions =
UNAuthorizationOptionAlert
| UNAuthorizationOptionSound
| UNAuthorizationOptionBadge;
[
requestAuthorizationWithOptions:authOptions
completionHandler:^(BOOL granted, NSError * _Nullable error) {
}
];
// For iOS 10 display notification (sent via APNS)
[ setDelegate:self];
// For iOS 10 data message (sent via FCM)
// [ setRemoteMessageDelegate:self];
#endif
}
[ registerForRemoteNotifications];
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果您没有放置正确的 SDK,可能会导致问题。确保你有这两个:</p>
<p>“Firebase/Core”和“Firebase/Messaging”</p></p>
<p style="font-size: 20px;">关于ios - Firebase通知不起作用ios,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/41958353/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/41958353/
</a>
</p>
页:
[1]