push-notification apple-push-notifications ios remote-notifications silent-notification
CKFetchNotificationChangesOperation返回INSERT操作,但UPDATE和DELETE并不总是如此.DELETE,UPDATE在我向App Store提交应用程序时最后工作,但现在不再了.为什么?我创建了以下订阅:
let s = CKSubscription(recordType: recordType, predicate: NSPredicate(value: true), options: .FiresOnRecordCreation | .FiresOnRecordUpdate | .FiresOnRecordDeletion)
s.notificationInfo = CKNotificationInfo()
subscriptionsToSave.append(s)
Run Code Online (Sandbox Code Playgroud)
仪表板显示所有树触发器:

我没有使用任何alertBody,所以通知是一个所谓的无声通知,它可能是原因吗?
在CloudKit提示和技巧讲师说,订阅需要从开发人员门户打开应用程序ID的APS功能.我不认为我有,但我只想要提取通知,只有在这有效时才推送.
背景能力? - 同样的
需要在app的信息plist中设置APS环境密钥. - 我想我拥有它.
我希望iOS11版本能解决无声推送问题,这是最新的测试版和通用版iOS版.
目前我很难理解,为什么我没有收到任何静音推送消息,这实际上应该唤醒我的应用程序以在后台执行一些所需的任务.
在iOS 10中,我只使用后台获取功能,并在我的AppDelegate中实现了"唤醒代码",如下面的代码所示.
在iOS 11中,注册代码仍然正常工作,我的后端也向Apples DEV服务器(沙箱)和PROD服务器(生产版本)提供推送通知.不幸的func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)是,静音推送通知从不调用该函数.
我真的错过了iOS 11的东西吗?
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// .. some variables here ...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// register silent push notification in backend
application.registerForRemoteNotifications()
// ... some code here ...
// Set Background Fetch Intervall for background services / terminated app
UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
// ... some code here ... …Run Code Online (Sandbox Code Playgroud) 我是Swift的新手,我正在创建聊天应用程序,我需要在app处于前台或最小化时发送通知.
但是当应用程序最小化时,我没有收到通知(它在连接USB时有效.
启用远程通知
Xcode设置中的背景提取
启用推送通知
生产APns证书
通知代码:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let gcmMessageIDKey = "gcm.message_id"
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Messaging.messaging().delegate = self
Messaging.messaging().shouldEstablishDirectChannel = true
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .sound, .badge]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
} else {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
application.registerUserNotificationSettings(settings)
}
application.registerForRemoteNotifications()
NotificationCenter.default.addObserver(self, selector: #selector(tokenRefreshNotification(_:)), name: …Run Code Online (Sandbox Code Playgroud) push-notification apple-push-notifications firebase swift4 ios11.3