1

私は非常に厄介な問題で立ち往生しています。

私は javaPNS を使用しており、インターネット上の多くのガイドの 1 つに従っています。

ここ: https://code.google.com/p/javapns/wiki/PushNotificationAdvanced

 /* Push your custom payload */ 
    List<PushedNotification> notifications = Push.payload(payload, keystore, password, production, devices);

あなたがこれを見るところ、上。Push.payload() は PushedNotificaion を含む List を返すと書かれています。まあ、それは私のコードではありません。

object Push {

def devPush(pushAlertMessage: String, badgeNumber: Int, devices: Seq[String]): List[PushedNotification] = {

//Retrieve the .p12 certification file
val keystoreFile = getClass.getResourceAsStream("keystorefile.p12")

//Create payload
val payload = PushNotificationPayload.complex()
payload.addBadge(badgeNumber)
payload.addAlert(pushAlertMessage)
payload.addSound("default")

//
val notifications:List[PushedNotification] = javapns.Push.payload(payload, keystoreFile, keystorePassword, false, devices)

for(notification <- javapns.Push.alert(pushAlertMessage, keystoreFile, keystorePassword, false, devices).getFailedNotifications){
    /* Add code here to remove invalid tokens from database */
}

notifications
}
}

Push.payload を使用して val 通知にリストを入れようとすると、次のように表示されます。

「タイプ PushedNotifications の Express は、期待されるタイプ List[PushedNotification] に準拠していません」

私は疲れて混乱しており、コードの残りの部分についても確信が持てません。助けていただければ幸いです。間違っている場合はコードを修正してください。

4

1 に答える 1