GUI is stuck with uibackgroundmodes= voip, audio

℡╲_俬逩灬. 提交于 2020-01-04 04:13:05

问题


I have tabbar-based application. When I put in my plist UIBackgroundModes (my application is supposed to support voip), the GUI doesn't load. It sucks on Splash screen and doesn't load the first tab view. When i remove the UIBackgroundModes property from info.plist, it works fine. More than that, pressing the home button when it stuck does nothing. Did somebody encountered a similar problem? (The problem exists on simulator)

Thanks,

Nava


回答1:


It appears, that the problem happens on Simulator only, it works on the device... So the solution (temporary one) is not to put UIBackgroundModes into info.plist for simulator version.




回答2:


You are responsible for loading/unloading the interface when going in and out of the background mode. You'll also need to update the interface accordingly when coming out of background.

iOS helps a bit by taking a screenshot before putting the app in background and displaying it when getting the app to foreground (a bit like Default.png when starting the app) and also some UIImage caching.

It might be worth sharing some code.




回答3:


Supporting Background State Transitions
Supporting the background state transition is part of the fundamental architecture for applications in iOS 4 and later. Although technically the only thing you have to do to support this capability is link against iOS 4 and later, properly supporting it requires some additional work. Specifically, your application delegate should implement the following methods and implement appropriate behaviors in each of them:

  • application:didFinishLaunchingWithOptions:
  • applicationDidBecomeActive:
  • applicationWillResignActive:
  • applicationDidEnterBackground:
  • applicationWillEnterForeground:
  • applicationWillTerminate:

Being a Responsible, Multitasking-Aware Application
Applications that run in the background are more limited in what they can do than a foreground application. And even if your application does not run in the background, there are are certain guidelines you should follow when implementing your application.

  • Do not make any OpenGL ES calls from your code. You must not create an EAGLContext object or issue any OpenGL ES drawing commands of any kind. Using these calls will cause your application to be terminated immediately.
  • [...]

iOS Application Programming Guide




回答4:


I see this bug as well. It's very annoying. It's as if the app is stuck in the simulator and won't keep going. When this happens, I know how to "unstick" it.

In the simulator I just go to menu Hardware > Lock and then unlock the phone again. Now I stop the debugger and start the app again. This seems to kick it back to life.

Fortunately this bug doesn't happen on a real phone, only in the simulator.



来源:https://stackoverflow.com/questions/4085698/gui-is-stuck-with-uibackgroundmodes-voip-audio

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