Je migre de parse.com à dirigeable urbaine, j'ai presque fini et tout fonctionne, mais une chose. Lorsque mon application est en cours d'ouverture et qu'une notification push est envoyée, la vue d'alerte NE s'affiche PAS. Si je mets l'application sur l'arrière-plan ou près l'application que je avec succèsreçoivent la notification .Urban Airship ne montre pas d'alerte dans l'application
J'ai essayer différentes choses pour le faire fonctionner, j'essayer d'ajouter:
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
UAirship.push().appRegisteredForRemoteNotificationsWithDeviceToken(deviceToken)
}
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
UAirship.push().appRegisteredUserNotificationSettings()
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
UAirship.push().appReceivedRemoteNotification(userInfo, applicationState: application.applicationState)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
UAirship.push().appReceivedRemoteNotification(userInfo,
applicationState:application.applicationState,
fetchCompletionHandler:completionHandler)
}
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], completionHandler:() -> Void) {
UAirship.push().appReceivedActionWithIdentifier(identifier!,
notification: userInfo,
applicationState: application.applicationState,
completionHandler: completionHandler)
}
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], withResponseInfo responseInfo: [NSObject : AnyObject], completionHandler:() -> Void) {
UAirship.push().appReceivedActionWithIdentifier(identifier!,
notification: userInfo,
responseInfo: responseInfo,
applicationState: application.applicationState,
completionHandler: completionHandler)
}
Et changer le UAConfig à automatiqueconfigurationdésactivé:
let config: UAConfig = UAConfig.defaultConfig()
config.automaticSetupEnabled = false
UAirship.takeOff(config)
I ont également ajouté à mon AppDelegate ceci:
class AppDelegate: UIResponder, UIApplicationDelegate, UAPushNotificationDelegate {
Et mettrecette:
UAirship.push().userNotificationTypes = [.Alert, .Badge, .Sound]
UAirship.push().pushNotificationDelegate = self
Mais rientravaillé, je suis vraiment frustré par cela parce que je ne peux pas le faire fonctionner et moi, la documentation du Urban Airship, ce n'est pas clair à ce sujet.
Si je ne me trompe pas, cela devrait fonctionner par défaut, sans faire tout cela, mais ce n'est pas le cas.
J'espère que quelqu'un peut me aider, voici mon code complet sans toutes les modifications:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Populate AirshipConfig.plist with your app's info from
// https://go.urbanairship.com
// or set runtime properties here.
let config: UAConfig = UAConfig.defaultConfig()
UAirship.takeOff(config)
UAirship.push().userPushNotificationsEnabled = true
// Clear badge
UAirship.push().resetBadge()
return true
}[...]}
J'utilise Swift 2, XCode 7.2.1 et iOS8 et Urban Airship 6.4.x
Merci
Il me manque quelque chose d'autre, parce que ça ne marche toujours pas:/ – Lucas
Comment configurez-vous le délégué de notification push? Il doit être réglé après 'UAirship.takeOff (config)'. – gatlinhebert
C'est comme ça. Je reçois le push sur mon iPhone, mais l'alerte n'est pas affichée. Dois-je créer une alerte à l'intérieur de ces méthodes? – Lucas