菜鸟教程小白 发表于 2022-12-12 13:03:29

应用程序的 iOS 8 声音不像在 iOS 7 中那样工作


                                            <p><p>我在 Xcode 5.1.1 中开发了我的游戏应用程序。昨天我下载了 Xcode 6.1.1。在 Xcode 6.1.1 中,当我上传任何 iOS 8.1 模拟器时,声音不起作用。但是,声音对于所有 iOS 7 模拟器来说都非常好。我正在为我的 .aiff 声音使用 AudioToolbox.framework。 iOS 7 和 iOS 8 应用程序之间是否存在编码差异?还是别的什么?</p>

<p>在我的 ViewDidLoad 中,声音代码...</p>

<pre><code> NSURL *SwishURL =pathForResource:@&#34;SwishSound&#34; ofType:@&#34;aiff&#34;]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)SwishURL, &amp;SwishID);
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我在音频方面遇到了同样的问题,但经过一番搜索,我发现了一个适用于 Xcode 6.1.1 <a href="http://raywenderlich.com/forums/viewtopic.php?f=2&amp;t=18819" rel="noreferrer noopener nofollow">here</a> 的有效解决方案.</p>

<p>实现是这样的:</p>

<pre><code>@import AudioToolBox;
@import AVFoundation;

NSString *soundPath = [ pathForResource:@&#34;sound_effect&#34; ofType: @&#34;wav&#34;];
NSURL *soundURL = ;
AVAudioPlayer *sound = [ initWithContentsOfURL:soundURL error:nil];

;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于应用程序的 iOS 8 声音不像在 iOS 7 中那样工作,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/27205105/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/27205105/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: 应用程序的 iOS 8 声音不像在 iOS 7 中那样工作