ios 10 Notifications click does nothing - ios

My code for notification execution is present in didRecieveRemoteNotification method in AppDelegate.
When a notification comes and is clicked on, the action is performed in iOS9 and iOS8, but in iOS10 nothing happens. On clicking the notification the app just opens.
I know this can be fixed with the new functions available in Xcode8 but what is the reason it is not working here?
I have seen some other apps, whose notifications work in iOS10 properly

Please see https://forums.developer.apple.com/message/169625#169625.
Apparently, iOS 10 doesn't call the method:
application:didReceiveRemoteNotification:fetchCompletionHandler:
Instead, it calls
application:didReceiveRemoteNotification:

Related

How do I call the launchOptions for iOS in reactnative

I have a push notification, and I want to get the content of the push notification when I click the push notification to run the application. What should I do?
The didFinishLaunchingWithOptions method is called automatically while pressing the notification banner opens your application (If its not already opened). See this for more.
What I think you need is to bridge between RN code and iOS native code (ObjC or swift) on the notification press action. This article might help

iOS 10 Push Notification Tap Handler

I am implementing Push Notifications the iOS 10 way and not able to figure out how would I intercept user's tap on the notification banner. None of the delegate call back gets called when user tap on the banner both in background and foreground mode. This looks more of an API issue in iOS SDK itself.
Anyone experienced the same and have a work around? Please let me know.
Ok, below delegate call back gets called when user tap on the notification. I had implemented specific actions on the notification banner and was putting a check on those action identifiers and completely missed the user tap :).
- (void)userNotificationCenter:(UNUserNotificationCenter *)iCenter didReceiveNotificationResponse:(UNNotificationResponse *)iResponse withCompletionHandler:(void(^)())iCompletionHandler

Actionable push notification isn't appearing on device with iOS 8+, when user force quit app by swiping-up

I am using ONE SIGNAL for push notification
ONE SIGNAL is providing functionality of actionable push by adding "actionButtons" key including in payload.
{"actionButtons" = {"id":"1","text":"Confirm","icon":""},{"id":"2","text":"Cancel","icon":""}, "actionSelected" = "1"}
So whenever push notification will appear on device, it will appear with two buttons "Confirm" and "Cancel" and based on user's selection 'id' of the button will be stored in "actionSelected" key.
Everything above is working perfectly whenever app is in either in foreground or in background in iOS 8+
But when user force quit application (swipe-up) notification isn't appearing on device.
I have also added "Remote Notifications" in background modes, all certificate is also set perfect. I don't know what am i missing.
If anyone got any idea about this issue then kindly help.
All suggestions are welcomed. Thanks in advance.
This is a limitation related to how OneSignal handles action buttons. OneSignal uses the content-available flag as part of a technique to support custom text on action buttons and this flag is ignored in cases where the application has been force-closed.
When force quitting any iOS app, that device becomes ineligible for notifications for that specific app until that app is ran again. So if you're testing open the app, and then close it (put in background).

didReceiveLocalNotification is never called in app icon touched launch

I can't find any right solution even after long searching. What is normal scenario in iOS in belows?
When the app gets local notification,
1) didReceiveLocalNotification is invoked when the app is in foreground. and also is invoked when notification banned touched launch.
However, under the same situation,
2) didReceiveLocalNotification method is not invoked by app icon touched launch.
Stackoverflow or Apple document said
in case of 2), applicationWillEnterForeground -> didReceiveLocalNotification -> applicationDidBecomeActive delegates process is normal. but I've never seen didReceiveLocalNotification in the case of touching app icon.
Please, give me an advice case 2) is normal or not. Help me!
Edit -
After having couple of comments, I've found a link such as Handling local notifications when the user presses the icon instead of the alert
This approach would be working I believe. Thanks.
Edit2 -
Local Notification
This link would be helpful as well.
That method is only called when your app is launched as a result of interacting with a local notification. Not seeing it called during a normal app launch is expected behaviour.

How to tell whether user opened app with notification with iOS 7 remote-notification background mode?

According to didReceiveRemoteNotification when in background , we used to be able to handle the user opening the app by clicking the action button on a push notification (or swiping on the push notification, depending on how the user sees push notifications) by implementing -application:didReceiveRemoteNotification: and then checking inside the method whether the application's applicationState was not active.
In iOS 7, there's the new remote-notification background mode, which allows the app to perform background fetch when a remote notification is displayed to the user (without the user necessarily doing anything to the notification). To support this mode, you are supposed to implement the -application:didReceiveRemoteNotification:fetchCompletionHandler: method.
The documentation for -application:didReceiveRemoteNotification: says that if your application delegate implements the application:didReceiveRemoteNotification:fetchCompletionHandler: method, then "the app object calls that method instead of this one." Which means we cannot use -application:didReceiveRemoteNotification: to handle remote notifications anymore, since it's not going to be called.
We should probably put handling logic in application:didReceiveRemoteNotification:fetchCompletionHandler:, but the previous trick for handling it doesn't make sense anymore -- previously, we depended on the fact that the only way for -application:didReceiveRemoteNotification: to be called when the app is not active was if the user tapped the action button on the notification to open the app. However, now, the whole point of the remote-notification background mode is that it can call application:didReceiveRemoteNotification:fetchCompletionHandler: in the background every time a remote notification is received, before the user does anything to it.
So then, how can we now tell when the user opens the app using the action button on the notification?
You still check the application state in application:didReceiveRemoteNotification:fetchCompletionHandler:
UIApplicationStateBackground - App is in the background receiving a push notification
UIApplicationStateInactive - App is opening from the user tapping a notification
I was use this delegate function to add the 『Notification Number』.
Cause our Server not send the Badge to our Clients.
Then I used the strange method to add the 『Notification Number』 with this delegate function, and I also add a code to switch UIViewController in this function.
I found out when I use the server push Notification to my test App, and the status of test App is in the background, even I am using Twitter or Safari.
My test App also switch UIViewController to another UIViewController after I push Notification from the server.

Resources