0
私のアプリケーションはオンラインストリームを再生します。ビューコントローラ間を移動しながらサウンドを再生する
しかし、ユーザーが次のビューコントローラーに移動すると、音楽が停止します。私が試した
- (void)start
{
@synchronized (self)
{
if (state == AS_PAUSED)
{
[self pause];
}
else if (state == AS_INITIALIZED)
{
NSAssert([[NSThread currentThread] isEqual:[NSThread mainThread]],
@"Playback can only be started from the main thread.");
notificationCenter =
[[NSNotificationCenter defaultCenter] retain];
self.state = AS_STARTING_FILE_THREAD;
internalThread =
[[NSThread alloc]
initWithTarget:self
selector:@selector(startInternal)
object:nil];
[internalThread setName:@"InternalThread"];
[internalThread start];
}
}
}
:ここでは音果たしているコードである
dispatch_async(dispatch_get_main_queue(),
^{
[internalThread start];
});
は、しかし、それは動作しません。誰にもこの経験はありますか?