我的应用程序(启动后)大约有 20 次似乎没有“开始接收远程控制事件”,因此 ios 遥控器默认为原生音乐播放器。因此,我的应用程序已被拒绝(在更新时,而不是初始版本),事情是我永远看不到它发生在 iPhone 插入 mac 和 xcode 时,只有在手机上运行应用程序时,下面是我的音频初始化常规。希望有人可以提供帮助,谢谢迈克。
-(void)viewDidAppear:(BOOL)animated
{
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
[[AVAudioSession sharedInstance] setDelegate: self];
//Set the audio category of this app to playback.
NSError *setCategoryError = nil; [[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
if (setCategoryError)
{
ShowMessageBox(@"Audio error", @"Category failed");
}
//Activate the audio session
NSError *activationError = nil;
[[AVAudioSession sharedInstance] setActive: YES error: &activationError];
if (activationError) {
ShowMessageBox(@"Audio error", @"Activate failed");
}
}
// And also
- (BOOL)canBecomeFirstResponder
{
return YES;
}