相关疑难解决方法(0)

iOS中的远程通知和静默通知有什么区别?

当我阅读Apple Docs时,他们提到了3种类型的通知:本地,远程和静默.

可以从应用程序本地发送的名称推断本地通知.

但是,其他两种类型的区别是什么?

push-notification apple-push-notifications ios remote-notifications silent-notification

41
推荐指数
2
解决办法
2万
查看次数

CKFetchNotificationChangesOperation有时不会返回UPDATE,DELETE通知

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环境密钥. - 我想我拥有它.

ios cloudkit ckfetchnotificationchange

8
推荐指数
1
解决办法
594
查看次数

iOS11 swift静态推送(后台提取,didReceiveRemoteNotification)不再起作用了

我希望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 background-fetch silentpush ios10 ios11

8
推荐指数
1
解决办法
5065
查看次数

当app处于后台(最小化)时,推送通知无效 - iOS

我是Swift的新手,我正在创建聊天应用程序,我需要在app处于前台或最小化时发送通知.

但是当应用程序最小化时,我没有收到通知(它在连接USB时有效.

  1. 启用远程通知

  2. Xcode设置中的背景提取

  3. 启用推送通知

  4. 生产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

6
推荐指数
1
解决办法
1378
查看次数