ios - Push notification not sending from my device only - Parse -


i have app in beta-testing has messaging functionality. it's set deliver push notification when user receives new message user. only time push notifications work when user sends message me specifically. if try send message other user or users message each other don't include me, push notifications not work. only messages sent me trigger push notifications on device.

here simple screenshots parse showing 1 push sent , 1 did not.

this private message sent user named "alissa" me in receive push notification (as can see "pushes sent" = 1):

working push notification

here details of said push:

working push notification details

now, here private message sent from device, same device received push notification properly, "alissa". can see, "pushes sent" = 0, meaning device sent message recipient did not receive push notification:

not working push notification

and here details of push, containing virtually identical information working 1 sent me:

not working push notification details

finally, here push not working sent between "alissa" , user not me, therefore 2 users separate device.

enter image description here enter image description here

this pattern when @ list of pushes users in app. have "pushes sent" = 0 except when push sent device, "pushes sent = 1".

i've printed console in push notification method completion handlers , indicate push sent when send message user. point out device being used development of app.

also side note, did not use this. couple weeks ago working normally. released multiple new builds , never had problem.

can guide me in right direction here?

edit: below i've included more details including code in app , details of developer account , parse backend.

relevant code in app

the following code have in appdelegate recommended parse include setting push notifications. it's worth noting println statements "did register user notification settings" , "did register remote notifications device token" both logged on app launch.

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {     // ...     let usernotificationtypes = uiusernotificationtype.alert | uiusernotificationtype.badge     let settings = uiusernotificationsettings(fortypes: usernotificationtypes, categories: nil)     application.registerusernotificationsettings(settings)     application.registerforremotenotifications()     // ... }  func application(application: uiapplication, didregisterusernotificationsettings notificationsettings: uiusernotificationsettings) {     println("did register user notification settings") }  func application(application: uiapplication, didregisterforremotenotificationswithdevicetoken devicetoken: nsdata) {     pfinstallation.currentinstallation().setdevicetokenfromdata(devicetoken)     pfinstallation.currentinstallation().saveinbackground()     println("did register remote notifications device token") }  func application(application: uiapplication, didfailtoregisterforremotenotificationswitherror error: nserror) {     println("didfailtoregisterforremotenotificationswitherror: ", error.localizeddescription) } 

this code have included when message sent user. it's worth nothing println statement "success" logged properly.

    pfinstallation.query().wherekey("user", equalto: incominguser)      pfpush().setquery(pushquery)     let sendername = pfuser.currentuser()!.objectforkey("name") as! string     let data = [         "alert" : "new message \(sendername)",         "badge" : "increment"     ]     push.setdata(data)     push.sendpushinbackgroundwithblock { (success: bool, error: nserror?) -> void in         if success {             println("success")         } else {             println(error?.localizeddescription)         }     } 

relevant details developer account

here screenshot showing app id in developer portal. seems show push notifications enabled (i deleted , re-added certificates new provisioning profile)

push notifications enabled in developer portal

relevant details parse account

here push notifications settings within parse. information updated yesterday when recreated certificates.

parse push notification settings

this might provide level of insight although i'm not sure what. screenshot of pfinstallations table in parse. installation created anytime logs in/opens app. ran application on device , record in table top one. what's different rest there value in "devicetoken" column device. when delete pfinstallation record , restart app recreate it, there value created under "devicetoken".

enter image description here

relevant details xcode

here expanded view of code signing in xcode build settings. code signing identical in both project , target code signing.

enter image description here enter image description here

again, push notifications working users messaging other users , not working when message sent device other user.

start makes device unique, , it's status development environment device culprit.

a place check device's build , consequent push certificate being used. if device in dev mode (meaning building , deploying phone via xcode), use push certificate development instead of production. (for more on difference, see this great article ray wenderlich)

the key factor here device use different certificate. if it's revoked/broken/not installed, device have problem.

you can test deploying app phone via testflight / hockeyapp / etc. instead of letting xcode load it.

update:

just pouring on code, checking errors. 1 thing of note: didfinishlaunchingwithoptions includes pfinstallation.currentinstallation().saveinbackground() - should remove , have in didregisterforremotenotificationswithdevicetoken method.

this why device has id in it's pfinstallation, , why device can't reach else - push system working, no no address call out there; silent fail on push, not on parse system.

have tried having users send push each other, or , you?


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -