Answer the question
In order to leave comments, you need to log in
What tools should be used to develop an ios application that is closely related to a web server (working with a PHP database)?
Good afternoon! The task is as follows: An application with a list of users, a chat between them, and various notifications.
How to implement everything correctly? How to notify the user about the receipt of new messages (now I'm polling the script on the server at a certain interval)?
The application uses a tab bar, when you receive a message above the icon, you need to display a badge with the number of new messages. Where should the code to do this be placed (and the question above is how to know when new messages arrive).
Who can advise what?
Answer the question
In order to leave comments, you need to log in
The code should be placed in the application's main delegate (usually AppDelegate.m) in a function
-(void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo;
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
// do stuff when app is active
}else{
// do stuff when app is in background
application.applicationIconBadgeNumber = application.applicationIconBadgeNumber - 1;
/* to increment icon badge number */
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question