My app only work in background ios 10

若如初见. 提交于 2019-12-25 04:24:31

问题


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 ,.


回答1:


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.



来源:https://stackoverflow.com/questions/40859236/my-app-only-work-in-background-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!