Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin.ios 尝试使用Monotouch在AVAudioPlayer中播放mp3时获得SIGSEGV_Xamarin.ios_Avaudioplayer_Iphone 4_Segmentation Fault - Fatal编程技术网

Xamarin.ios 尝试使用Monotouch在AVAudioPlayer中播放mp3时获得SIGSEGV

Xamarin.ios 尝试使用Monotouch在AVAudioPlayer中播放mp3时获得SIGSEGV,xamarin.ios,avaudioplayer,iphone-4,segmentation-fault,Xamarin.ios,Avaudioplayer,Iphone 4,Segmentation Fault,我正在尝试用以下代码播放mp3文件 AVAudioPlayer player = new AVAudioPlayer(); NSUrl mediaFile = NSUrl.FromFilename(monkeySound); player = AVAudioPlayer.FromUrl(mediaFile); player.Delegate = new PlayerDelegate(); if(player.PrepareToPlay()){ player.Play();

我正在尝试用以下代码播放mp3文件

 AVAudioPlayer player = new AVAudioPlayer();
 NSUrl mediaFile = NSUrl.FromFilename(monkeySound);
 player = AVAudioPlayer.FromUrl(mediaFile);
 player.Delegate = new PlayerDelegate();
 if(player.PrepareToPlay()){
     player.Play();
 }

private class PlayerDelegate:AVAudioPlayerDelegate {

        public PlayerDelegate(){

        }

        public override void FinishedPlaying (AVAudioPlayer player, bool flag)
        {
            //Some Stuff Done Here               
        }
}
这是我得到的错误: 堆栈跟踪:

    0   MonkeyShot                          0x000d0d25 mono_handle_native_sigsegv + 343
    1   MonkeyShot                          0x0000f6f4 mono_sigsegv_signal_handler + 322
    2   libSystem.B.dylib                   0x992a345b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   AVFoundation                        0x0047c28d -[AVAudioPlayer privCommonCleanup] + 50
    5   AVFoundation                        0x0047c339 -[AVAudioPlayer dealloc] + 51
    6   ???                                 0x0a2af91c 0x0 + 170588444
    7   ???                                 0x0a2cab1c 0x0 + 170699548
    8   ???                                 0x077520d6 0x0 + 125116630
    9   MonkeyShot                          0x0000f4af mono_jit_runtime_invoke + 1332
    10  MonkeyShot                          0x001ed319 mono_runtime_invoke + 137
    11  MonkeyShot                          0x0029da57 monotouch_trampoline + 2527
    12  Foundation                          0x0140d94e __NSThreadPerformPerform + 251
    13  CoreFoundation                      0x00e9f8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    14  CoreFoundation                      0x00dfd88b __CFRunLoopDoSources0 + 571
    15  CoreFoundation                      0x00dfcd86 __CFRunLoopRun + 470
    16  CoreFoundation                      0x00dfc840 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x00dfc761 CFRunLoopRunInMode + 97
    18  GraphicsServices                    0x0404b1c4 GSEventRunModal + 217
    19  GraphicsServices                    0x0404b289 GSEventRun + 115
    20  UIKit                               0x01cdfc93 UIApplicationMain + 1160
    21  ???                                 0x09d530a3 0x0 + 164966563
    22  ???                                 0x09d52e74 0x0 + 164966004
    23  ???                                 0x09d52474 0x0 + 164963444
    24  ???                                 0x09d522cc 0x0 + 164963020
    25  ???                                 0x09d5241e 0x0 + 164963358
    26  MonkeyShot                          0x0000f4af mono_jit_runtime_invoke + 1332
    27  MonkeyShot                          0x001ed319 mono_runtime_invoke + 137
    28  MonkeyShot                          0x001efa00 mono_runtime_exec_main + 669
    29  MonkeyShot                          0x001eedea mono_runtime_run_main + 843
    30  MonkeyShot                          0x000a3083 mono_jit_exec + 200
    31  MonkeyShot                          0x002a1697 main + 3838
    32  MonkeyShot                          0x00002809 _start + 208
    33  MonkeyShot                          0x00002738 start + 40
at(包装器管理为本机)MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr) 在Stimouou.Posith.NasObjt/MangouChueAdv.Eng/UndoCuff.Fask.NSObj[0x000 02a]中/用户/等离子体/源/ IPOR/MUROUCH/N粉底/NSObjul.Cs:305 在(包装器运行时调用)。运行时调用此对象(对象,intptr,intptr,intptr) at(包装器管理为本机)MonoTouch.UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) 在/Users/plasma/Source/iphone/MonoTouch/UIKit/UIApplication.Main(字符串[],字符串,字符串)[0x00038]中 位于/Users/plasma/Source/iphone/MonoTouch/UIKit/UIApplication.Main(字符串[])中的[0x00000] 在/Users/fencer04/Projects/MonkeyShot/MonkeyShot/Main.cs:14中的MonkeyShot.Application.Main(字符串[])[0x00000]处 在(包装器运行时调用)。运行时调用无效对象(对象,intptr,intptr,intptr)

本机堆栈跟踪:

    0   MonkeyShot                          0x000d0d25 mono_handle_native_sigsegv + 343
    1   MonkeyShot                          0x0000f6f4 mono_sigsegv_signal_handler + 322
    2   libSystem.B.dylib                   0x992a345b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   AVFoundation                        0x0047c28d -[AVAudioPlayer privCommonCleanup] + 50
    5   AVFoundation                        0x0047c339 -[AVAudioPlayer dealloc] + 51
    6   ???                                 0x0a2af91c 0x0 + 170588444
    7   ???                                 0x0a2cab1c 0x0 + 170699548
    8   ???                                 0x077520d6 0x0 + 125116630
    9   MonkeyShot                          0x0000f4af mono_jit_runtime_invoke + 1332
    10  MonkeyShot                          0x001ed319 mono_runtime_invoke + 137
    11  MonkeyShot                          0x0029da57 monotouch_trampoline + 2527
    12  Foundation                          0x0140d94e __NSThreadPerformPerform + 251
    13  CoreFoundation                      0x00e9f8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    14  CoreFoundation                      0x00dfd88b __CFRunLoopDoSources0 + 571
    15  CoreFoundation                      0x00dfcd86 __CFRunLoopRun + 470
    16  CoreFoundation                      0x00dfc840 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x00dfc761 CFRunLoopRunInMode + 97
    18  GraphicsServices                    0x0404b1c4 GSEventRunModal + 217
    19  GraphicsServices                    0x0404b289 GSEventRun + 115
    20  UIKit                               0x01cdfc93 UIApplicationMain + 1160
    21  ???                                 0x09d530a3 0x0 + 164966563
    22  ???                                 0x09d52e74 0x0 + 164966004
    23  ???                                 0x09d52474 0x0 + 164963444
    24  ???                                 0x09d522cc 0x0 + 164963020
    25  ???                                 0x09d5241e 0x0 + 164963358
    26  MonkeyShot                          0x0000f4af mono_jit_runtime_invoke + 1332
    27  MonkeyShot                          0x001ed319 mono_runtime_invoke + 137
    28  MonkeyShot                          0x001efa00 mono_runtime_exec_main + 669
    29  MonkeyShot                          0x001eedea mono_runtime_run_main + 843
    30  MonkeyShot                          0x000a3083 mono_jit_exec + 200
    31  MonkeyShot                          0x002a1697 main + 3838
    32  MonkeyShot                          0x00002809 _start + 208
    33  MonkeyShot                          0x00002738 start + 40
来自gdb的调试信息:

/tmp/mono gdb命令。0GDVJY:1:源命令文件中出现错误: 无法自行调试

=============================================================== 在执行本机代码时收到SIGSEGV。这通常表明 mono运行时或某个本机库中出现致命错误


由您的应用程序使用。我不知道这是否是您的问题,但我在使用C#风格的委托方法和AVAudioPlayer时遇到了一些问题。如果这与我的问题类似,那么使用“WeakDelegate”构造和导出方法可能会很有用。

Hi Justin。你找到解决问题的办法了吗?