我有以下代码,可以从AUAudioUnit设置AVAudioUnit作为AVAudioEngine的一部分。
我注意到在iOS 11中引入了AVAudioUnit的AUAudioUnit属性。我从Xcode收到警告:
'AUAudioUnit'仅在iOS 11.0或更高版本上可用
@property (nonatomic, assign) AudioComponentDescription audioProcessorAUDescription;
@property (nonatomic, strong) AUStereoProcessor* audioProcessor;
@property (nonatomic, strong) AVAudioNode* audioNode;
//...
[AVAudioUnit instantiateWithComponentDescription:self.audioProcessorAUDescription options:0 completionHandler:^(__kindof AVAudioUnit * _Nullable audioUnit, NSError * _Nullable error)
if (audioUnit && error == nil) {
self.audioNode = audioUnit;
self.audioProcessor = (AUStereoProcessor*) self.audioNode.AUAudioUnit;
//...
是否可以使代码与iOS 8或9兼容?
编辑”我刚刚在运行iOS 10.3的设备上测试了代码,并且工作正常……我想知道这是否是API中的错误?