-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Dashboard Delivery Report is 0 for send and receive messages #3750
Comments
Hi, if I send an message from parse dashboard, the push notification receives on iOS. I see the notification, but in dashboard the sent and deliver is 0. How I can fix that? import UIKit
import UserNotifications
import Parse
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ****************************************************************************
// Initialize Parse SDK
// ****************************************************************************
let configuration = ParseClientConfiguration {
$0.applicationId = "ParsePlayground"
$0.server = "https://whispering-spire-56438.herokuapp.com/parse"
$0.isLocalDatastoreEnabled = true
}
Parse.initialize(with: configuration)
if PFUser.current() == nil {
print("no current user set")
self.showLoginViewController()
} else {
print("current user set")
}
let defaultACL = PFACL()
// If you would like all objects to be private by default, remove this line.
defaultACL.getPublicReadAccess = true
PFACL.setDefault(defaultACL, withAccessForCurrentUser: true)
if let currentUser = PFUser.current() {
PFInstallation.current()?.setObject(currentUser, forKey: "user")
}
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.delegate = self
notificationCenter.requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
if error == nil{
UIApplication.shared.registerForRemoteNotifications()
}
}
// Override point for customization after application launch.
return true
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
print("User Info = ", userInfo)
PFPush.handle(userInfo)
PFAnalytics.trackAppOpened(withRemoteNotificationPayload: userInfo)
completionHandler([.alert, .badge, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
print("User Info = ", userInfo)
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
//--------------------------------------
// MARK: Push Notifications
//--------------------------------------
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let installation = PFInstallation.current()
installation?.setDeviceTokenFrom(deviceToken as Data)
installation?.saveInBackground()
}
private func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
if error.code == 3010 {
print("Push notifications are not supported in the iOS Simulator.\n")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
}
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
PFPush.handle(userInfo)
application.applicationIconBadgeNumber = 0;
PFAnalytics.trackAppOpened(withRemoteNotificationPayload: userInfo)
}
/**
Zeigt LoginViewController
*/
public func showLoginViewController() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let loginViewController = storyboard.instantiateViewController(withIdentifier: "LoginViewController")
self.window?.rootViewController = loginViewController
}
/**
Zeigt RegisterViewController
*/
public func showRegisterViewController() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let registerViewController = storyboard.instantiateViewController(withIdentifier: "RegisterViewController")
self.window?.rootViewController = registerViewController
}
/**
Zeigt MainTabBarController
*/
public func showMainTabBarViewController() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainTabBarController = storyboard.instantiateViewController(withIdentifier: "MainTabBarController")
self.window?.rootViewController = mainTabBarController
}
} |
Can you provide the logs when running VERBOSE=1 ? |
I am having the same problem. I am able to successfully send a push to an IOS device however the Parse Dashboard reports 0 sent. Parse Server 2.4.0 is running on Heroku and the parse-server-push-adapter is 1.3.0 I created the push through the dashboard by specifying IOS devices and a specific user objectId. The log output with VERBOSE=1 follows (I've flagged two lines in bold that I've not seen before): 2017-05-17T19:39:58.311430+00:00 heroku[router]: at=info method=POST path="/parse/push" host=murmuring-meadow-91837.herokuapp.com request_id=0df0a61e-e467-4a05-888e-4fca92a904b0 fwd="158.57.45.68" dyno=web.1 connect=0ms service=41ms status=200 bytes=533 protocol=https Let me know if you need more details. This problem does not occur on pushes sent from my local parse-server where parse-dashboard correctly reports the number of pushes sent. EDIT 2nd EDIT |
Bump. |
hi guys, |
Here is the solution of this problem - just add this code to home view
|
Can you update to the latest version? A lot has changed and was fixed in the latest versions for pushes. |
@flovilmart I would try it the next days. |
Did anyone find a solution for this? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
No description provided.
The text was updated successfully, but these errors were encountered: