unity iOS应用切换到后台之后持续运行
2016-10-17 11:36
393 查看
https://forum.unity3d.com/threads/continue-running-app-in-background-for-audio-generation-ios.110512/
class IHookEvent;
bool PlayerLoop (bool, bool,
IHookEvent*);
NSTimer *aTimer;
@implementation AppController
- (void) applicationDidBecomeActive:(UIApplication*)application
{
if (_didResignActive)
{
[aTimer
invalidate];
}
_didResignActive = NO;
}
- (void) applicationWillResignActive:(UIApplication*)application
{
aTimer = [NSTimer
scheduledTimerWithTimeInterval:1.0 target:self
selector:@selector(UpdateUnityInTheBackground) userInfo:nil
repeats:YES];
_didResignActive = YES;
}
- (void) UpdateUnityInTheBackground
{
PlayerLoop(true, true, NULL);
}
class IHookEvent;
bool PlayerLoop (bool, bool,
IHookEvent*);
NSTimer *aTimer;
@implementation AppController
- (void) applicationDidBecomeActive:(UIApplication*)application
{
if (_didResignActive)
{
[aTimer
invalidate];
}
_didResignActive = NO;
}
- (void) applicationWillResignActive:(UIApplication*)application
{
aTimer = [NSTimer
scheduledTimerWithTimeInterval:1.0 target:self
selector:@selector(UpdateUnityInTheBackground) userInfo:nil
repeats:YES];
_didResignActive = YES;
}
- (void) UpdateUnityInTheBackground
{
PlayerLoop(true, true, NULL);
}
相关文章推荐
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解 .
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- 转载 -- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- IOS实现Voip应用后台运行需要的几个配置项
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- ios应用UIApplication前后台切换代理方法在不同ios系统下的差异
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- 转:iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用后台运行GPS定位功能的实现
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解