SIGSTOP异常

时间:2012-09-18 10:53:04

标签: objective-c exception avaudioplayer

我是XCode和Objective-C的新手。当我让应用程序在模拟器中运行时,我有这个异常poppin'。在iPad上它工作正常。分配AVaudioPlayer后,我停止并发出警告SIGSTOP。

有人有什么建议吗?这是一个严重的例外吗?提前谢谢!

我不知道在哪里找到'堆栈跟踪'所以我把RUN调试器放到gdb: 来自的信息: 待定断点1 - “”soundScape.m“:112”已解决 rndmitem

URL

SIGSTOP之前的行是:

的libc ++ abi.dylib`__cxa_throw:
0x46e4a44:pushl%ebp
0x46e4a45:movl%esp,%ebp

当前语言:auto;目前的目标-c
0x1似乎不指向有效对象 0x2似乎没有指向有效的对象 文件://localhost/Users/myName/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/E92E5F03-0B07-4AF0-BFB4-E1F7009A4E78/babyschets.app/02Seawash.mp3
[切换到处理81163线程0x1720b]
[切换到处理81163线程0x15803]


在例外状态登记册中:
trapno =(unsigned int)0x000003
err =(unsigned int)0x000000
faultvaddr =(unsigned int)0x087df732


例如,当值为以下值时会发生这种情况:

randomItem
(NSUInteger)$ 0 = 1 [没有Objective-C描述]
amountOfAudioFiles
(int)$ 1 = 2 [没有Objective-C描述]
网址
(NSURL *)$ 2 = 0x07485860
文件://localhost/Users/myName/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/E92E5F03-0B07-4AF0-BFB4-E1F7009A4E78/babyschets.app/02Seawash .MP3

audioFiles1
(NSArray *)$ 4 = 0x0747d720< __ NSArrayI 0x747d720>(
01Seawash.mp3,
02Seawash.mp3

int amountOfAudioFiles = [audioFiles1 count];
NSUInteger randomItem = arc4random()%(int)amountOfAudioFiles;

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                     pathForResource:[NSString stringWithString:[audioFiles1 objectAtIndex:randomItem]]
                                     ofType:nil]];

NSError *error;

audioPlayer1 = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];

好的,我已经清理了这段代码,这是我的解决方案。现在它像魅力一样运行:

.h文件中的

:      @property(nonatomic,retain)AVAudioPlayer * audioPlayer1;

<。>文件中的

int amountOfAudioFiles = [audioFiles1 count];
int randomItem = (int)(arc4random()%amountOfAudioFiles);
if (randomItem < 0) randomItem = 0;

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                     pathForResource:[NSString stringWithFormat:@"%@", [audioFiles1 objectAtIndex:randomItem]]
                                     ofType:nil]];


if (audioPlayer1) {
    if (audioPlayer1.isPlaying) {
        [audioPlayer1 stop];
        audioPlayer1 = nil;
    }

} else {
    audioPlayer1 = [AVAudioPlayer alloc];
}

NSError *error;
audioPlayer1 = [audioPlayer1 initWithContentsOfURL:url error:NULL];

1 个答案:

答案 0 :(得分:0)

这意味着iOS版本中不存在Object(在框架中)。 也许你需要更新你的iOS设备的iOS,你可以在其中测试/运行App。