0
嘿我希望在用戶按下按鈕而不是它後,提示推送通知一旦應用程序啓動請求。我會怎麼做?這是我在我的應用程序委託中所擁有的。特別提醒用戶何時允許推送通知
OneSignal.initWithLaunchOptions(launchOptions, appId: "myKey")
if application.responds(to: #selector(UIApplication.registerUserNotificationSettings(_:))) {
let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
let types: UIRemoteNotificationType = [UIRemoteNotificationType.badge, UIRemoteNotificationType.alert, UIRemoteNotificationType.sound]
application.registerForRemoteNotifications(matching: types)
}
試過了,但它似乎仍顯示應用程序何時啓動。它有一些事情要做w/OneSignal.initWithLaunchOptions(launchOptions,appId:「myKey」),但我不知道我應該用什麼來替代launchOptions –