Krekin
Krekin

Reputation: 1560

Message notification when inside another view controller

I'm carrating on an app that was written by a programmer before me. It has only 2 view controllers: the main one displaying chat (its the root view controller) and a second one to tinker with your profile. I was asked to implement some kind of notification (preferably one that pops up at the top of the screen) to the user that a message has arrived when they are inside that profile-tinkering view controller. Must I use the APNS server technique, or can I use an easier technique by utilizing the App Delegate somehow?

Upvotes: 0

Views: 58

Answers (2)

Alap Anerao
Alap Anerao

Reputation: 2153

When you are inside another view, the APNS wont get displayed because the application is already in foreground.

When app is in foreground and you receive an APNS, didReceiveRemoteNotification method will get called.

You can read APNS package here and notify user of this in a way you want, for e.g. you can display an alert.

Upvotes: 1

PenotyDelPiero
PenotyDelPiero

Reputation: 63

  1. Use APNS, I prefer the local notification,didReceiveLocalnotification method will get called,then display an alert
  2. Use delegate,assign delegate to the profile controller,and implement the required method,when you have a message arrived,display an alert

Upvotes: 1

Related Questions