我的应用程序仅在后台ios 10中工作 [英] My app only work in background ios 10
问题描述
我有ios应用程序(phonegap),该应用程序的想法是检测是否有headsrt,记录和播放音频,这是我的应用程序的问题,它仅在后台运行.
当我在前台运行该应用程序时,当我单击记录"按钮时,它什么也没做,但是当我按下主页"按钮并返回到后台时,所有的事情都可以正常工作.
我还放置了测试按钮,当我单击它时,它应该以消息提醒u,仅当我按下主页按钮然后返回到前台时,消息才会出现.
请注意,它在ios 9中运行完美
但是在ios 10中不起作用
摘要: 该应用程序只有在后台运行时才能运行,而在前台运行时则不能运行..
由于iOS 10 UIWebView中Content-Security-Policy
元标记的行为发生了变化,因此您的应用程序具有这样的行为.副作用之一是,只有在应用程序进入后台(即按下主页"按钮)后,才会执行插件调用.
您可以通过更新Content-Security-Policy
元标记以添加gap://
协议来解决此问题-参见我对这个问题的回答了解详情.
I have ios app ( phonegap ) , the idea of my app to detect if there is headsrt , record and play audio , the problem of my app its only work in background .
When I click record button when the app in foreground , its did not do any thing , but when I press home button and go to back ground , every thing work .
Also I have put test button , when I click it , it should alert u with message , the message not appear only if I press home button and then come back to foreground .
Please note it was work perfectly in ios 9
But in ios 10 not work
Summary : The application only work if its in background , but in foreground not work ,.
Your app is behaving like this because of the change in behaviour of the Content-Security-Policy
meta tag in the iOS 10 UIWebView. One of the side effects is that plugin invocations are not executed until the app is put into the background (i.e. pressing the "Home" button).
You can resolve this by updating the Content-Security-Policy
meta tag to add the gap://
protocol - see my answer to this question for details.
这篇关于我的应用程序仅在后台ios 10中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!