I receive my push notification successfully but when I tap on it, it simply takes me to first view when my app loads.
I want the user to go to specific views depending on the push notification because the user will be receiving many different push notifications (1 for each soccer team, hence possiblity of many different views).
So example: I have a view controller called manchesterUnitedView and somebody just scored so the user receives a push notification for that particular view. When they press it, I want it to take them to the manchesterUnitedView.
Does anyone know how to do this?
thanks
You can use the payload of the notification to pass the information you need to the app, then retrieve it and use it when the app is launched as a result of the user tapping on a notification.
To do this just add a custom dictionary to the JSON payload of the notification and add the information you need to pass to the app there.
See here for details on the payload format.
You can then retrieve your custom dictionary when the app is launched in the application:didFinishLaunchingWithOptions: method implementation of your UIApplicationDelegate and use it to initialize your application state.
See here for documentation of how to retrieve the payload in your UIApplicationDelegate.
I am also interested in this.
The following should work:
I receive the Push on my iPhone and after clicking the "View" Button the App should open, and then i can read the full message.
just like here on this site (bottom): http://www.myfitapp.de/fitnessstudio-app/push-nachrichten/
Related
I would like to trigger the Apple Watch notification and or the glance views from the main app.
I know how to run them in XCode and selecting those directly, but I need to make them popup from inside the main app programmatically.
In my main app I have a timer that today creates a popup to tell the user something. I would like that same trigger to show the notification view on the apple watch along with dynamic text. To keep it simple for now, suppose I have a button (IBAction). when the button is pressed in the main app I would like to show a glance or show the notification views on the watch. I am guessing this is fairly simple to do but havent been able to make it work, yet.
If you have some sample code that would be great!
Thank you for any help!
While iOS automatically shows notification controller when app receives remote or local notification.
But during development, you can trigger a notification or glance by changing Watch Interface in WatchKit App Schema. (Edit Schema -> (Under Info) Change Watch Interface to Glance/Static Notification / Dynamic Notification ).
However, Selecting Notification requires Notification Payload (create .apns file and set it to Notification Payload while editing schema) as well.
Hope it helps !
I have set up push notifications successfully on my app but I want the user to go to a certain view when the swipe the notification (iOS 5) opposed to just starting the app up.
The view controller is called statsViewController
Does anyone know how to do this? Thanks in advance
You can add a custom dictionary to your push notification payload. See Apple's push notification guide. When you receive the notification, grab the payload and load the view controller based on what's inside.
I'm building an iPhone app which gets updates from the web at regular time intervals and when the user is browsing through the apps data.
I have a class called updateManager which handles the updating process.
When the updating process is finished (0.1-3.0 seconds later) the data in my app could be changed but the user is still viewing the old (false) data. This causes big problems when the user is viewing a (drill-down)tableview and he selects a cell which data doesn't exist anymore.
Is there a way to access the current view(controller) from another class and reload it's (table)view? It is not possible to send the current view controller to the updateManager since the user could have changed view's while the update is in progress
EDIT:
I looked at this post: Reload a tableView from the AppDelegate but i think the problem with the user switching views while updating is still there isn't it?
Not sure that's the best solution. You get a more decoupled design if you use the Observer pattern instead. Use NSNotificationCenter to post a notification when the data changes. Then any view who is displaying data would subscribe to those notifications and can then reload the table upon such an event.
i would fire a NSNotification with the NSNotification Center
Your ViewController with the TableView listen to the Notification (and reload your table view if the notification fired) and your update Class fire the Notification if the data changed.
I am making an app which basically presents data (from plist) to user in table form. I have a lot of controllers and the user basically navigates through these controller to get to an item after which a final detail display is shown.
At that last view, the user can add that to favorites.
The way that I am passing data to view controller is that I pass them specific data, so at the last view, if the user adds the item to favorites, I write that data to file. But how can I tell all my other controller that the data has updated?
This is more of a design problem and I don't know where to go..I have some idea but I want to know what is the standard way of doing this...Thanks.
If you're going to be listening for events within multiple objects, take a look at NSNotificationCenter. You can simply subscribe to listen for notifications then post one once the data is updated.
NSNotificationCenter Class Reference
I´m building an app which simulates an Inputstream of information from a sensor. When information are detected and parsed I want to send Notifications, that will be observed
by the different views which update themselves to a given timeintervall.
Is its MVC compliant to use Notifications to get a connection from Model/Controller to the View?
I´m asking because I´m often reading about Views sending Notifications to the Controller when a User interacted with the UI.
Thanks
The view is supposed to be just a view and should not have to receive notifications to update itself. I am not saying I have not done this myself as it work having the view update itself. I would recommend that you design your application so that your view controllers receive the notifications and update the views appropriately. Use your views to display and interact with the user sending any interaction updates to your view controller and the view controller sending any display updates to the view.