I have researched enough before asking this question.
I work with GCM[Google Cloud Messaging] for push notifications.
this is the message which I send from GCM
{
"to" : "....",
"notification": {
"sound": "default",
"badge": "1",
"title": "A Message Received",
"body": "Please open messages",
},
"content_available":true,
"priority": "high",
"data":{
"message":"heey"
}
}
as I have read from other sites, it told if you want a silent notification put content_available in the headers, and it would work correct.
everything is fine and working with this method.
but the only problem is when application has been forced closing by user. it can not handle the code in
func application( application: UIApplication,
didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler handler: (UIBackgroundFetchResult) -> Void) {
}
in other question that has an answer said there is no solution for it. except pushkit in IOS 8.
some told this link can help:
https://zeropush.com/guide/guide-to-pushkit-and-voip
but I couldn't use it. some steps are not clear.
My Request is if anyone know the best solution or a piece of code for PushKit framework or anything that can help me.