Non*_*oto 5 iphone ios automatic-ref-counting
我将下面显示的代码更改为ARC兼容.
我只是像Xcode建议的那样改变它,并且它在Xcode上没有显示错误.但是一旦事件发生,代码就会崩溃.有人有想法解决这个问题吗?
我不确定这种迷恋是否因为acapela SDK而发生.
这是非ARC代码,它工作正常.
void MyInterruptionListener(void *inClientData, UInt32 inInterruptionState) {
AcapelaSpeech* anAcapelaSpeech = *(AcapelaSpeech**)inClientData;
if (inInterruptionState == kAudioSessionBeginInterruption) {
[anAcapelaSpeech setActive:NO];
status = AudioSessionSetActive(NO);
}
if (inInterruptionState == kAudioSessionEndInterruption) {
status = AudioSessionSetActive(YES);
[anAcapelaSpeech setActive:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
这是ARC兼容的,但它会破坏[anAcapelaSpeech setActive:NO] ;.
void MyInterruptionListener(void *inClientData, UInt32 inInterruptionState) {
AcapelaSpeech* anAcapelaSpeech = (__bridge_transfer AcapelaSpeech*)inClientData;
if (inInterruptionState == kAudioSessionBeginInterruption) {
[anAcapelaSpeech setActive:NO];
AudioSessionSetActive(NO);
}
if (inInterruptionState == kAudioSessionEndInterruption) {
AudioSessionSetActive(YES);
[anAcapelaSpeech setActive:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
附加信息. 我正在使用Acapela音频SDK,音频中断代码显示在此PDF的中断. http://www.ecometrixem.com/cms-assets/documents/44729-919017.acapela-for-iphone.pdf
这是暗恋的截图.

已解决 此代码有效,谢谢.
void MyInterruptionListener(void *inClientData, UInt32 inInterruptionState) {
AcapelaSpeech *anAcapelaSpeech = (__bridge id) (*(void **) inClientData);
if (inInterruptionState == kAudioSessionBeginInterruption) {
[anAcapelaSpeech setActive:NO];
AudioSessionSetActive(NO);
}
if (inInterruptionState == kAudioSessionEndInterruption) {
AudioSessionSetActive(YES);
[anAcapelaSpeech setActive:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2066 次 |
| 最近记录: |