将iOS的清醒我的应用程序时,我收到无声推送通知?(如果应用程序是不是在运行状态) [英] Will iOS awake my app when i receive silent push notification?(When app is not in running state)

查看:147
本文介绍了将iOS的清醒我的应用程序时,我收到无声推送通知?(如果应用程序是不是在运行状态)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新问题:

的要求;当我收到通知无语,我想运行一个Web服务,显示通知栏的单行。它如果应用程序也被杀害的工作。任何解决方法吗?

我想下面的下面的方法。

I am trying following method below.

我是新来的iOS和我挣扎着无声推送通知,用Google搜索了很多,卡住了。
将iOS的清醒我的应用程序时,我收到时,应用程序无法启动无声推送通知(即当应用从应用程序切换器中删除)。

I am new to iOS and i struggled with silent push notification,googled a lot and got stuck. Will iOS awake my app when i receive silent push notification when app is not launched(i.e when app is removed from app switcher).

我的工资载荷是

{ 
      aps: {
              content-available: 1,
              sound: ""
     }
}

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler{

int CA=[[[userInfo valueForKey:@"aps"] valueForKey:@"content-available"] intValue];

if (CA==1) {

    my action...

}

 completionHandler(UIBackgroundFetchResultNewData);
}

此方法被调用,当应用程序在前台和background.cant醒了我的应用程序时,应用程序是不是在运行状态下正常工作(即应用程序未启动或应用切换器杀死)。

this method is called and works fine when app is in foreground and background.cant awake my app when app is not in running state(i.e app is not launched or killed from app switcher)..

推荐答案

如果在App已经被从App切换器中删除,iOS版也不会醒你的应用程序,因为用户明确要求关闭您的应用程序。

If the App has been removed from the App Switcher, iOS will not awake your app, since the user specifically asked for closing your app.

如果用户打开应用至少一次,并不会从应用程序切换器中删除,将iOS的唤醒您的应用程序

If the user open your app at least once, and do not remove it from App Switcher, iOS will awake your app

我们所做的服务器端的处理是这样的:
如果用户的应用程序不会在连接分钟我们发出无声的通知,(你可以将其设置为你希望)后,我们再派非无声推送通知,以提醒用户。
由于应用程序(不是由用户关闭)会自动获取数据,应采取一分钟。

What we have done server-side to handle this is : If the user's app doesn't connect in the minute after we sent the silent notification, (you can set it as you wish), we send another non-silent push notification to alert the user. Since the App (is not closed by the user) should automatically fetch data, it should take under a minute.

但对于那当然你需要一个更复杂的服务器code不是简单地发送无声的推动。

But for that of course you need a more complex server code than simply sending silent push.

这篇关于将iOS的清醒我的应用程序时,我收到无声推送通知?(如果应用程序是不是在运行状态)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆