iphone - 应用程式当机-无法找出原因

标签 iphone xcode cocoa-touch crash

我的应用程序在首次启动时会崩溃,但是在我再次启动时会崩溃。该应用程序很好。

当我按下一个按钮时,它会崩溃,该按钮会播放声音,并允许用户更改所播放歌曲的音高和BPM。

这是日志中的崩溃报告

This GDB was configured as "x86_64-apple-darwin".Attaching to process 1842.
2012-07-31 19:40:33.437 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.447 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.477 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.483 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.493 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.498 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.508 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:33.515 DubstepDJ[1842:16a03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-31 19:40:42.449 DubstepDJ[1842:16a03] Starting

这是它崩溃的代码
- (OSStatus) readFloatsConsecutive:(SInt64)numFrames intoArray:(float**)audio
{
    OSStatus err = noErr;

    if (!mExtAFRef) return -1;

    int kSegmentSize = (int)(numFrames * mExtAFNumChannels * mExtAFRateRatio + .5);
    if (mExtAFRateRatio < 1.) kSegmentSize = (int)(numFrames * mExtAFNumChannels /
        mExtAFRateRatio + .5);

    AudioBufferList bufList;
    UInt32 numPackets = numFrames; // Frames to read
    UInt32 samples = numPackets * mExtAFNumChannels;
    UInt32 loadedPackets = numPackets;

    short *data = (short*)malloc(kSegmentSize*sizeof(short));
    if (!data) {
        NSLog(@"data is nil");
        goto error;
    }

    bufList.mNumberBuffers = 1;
    bufList.mBuffers[0].mNumberChannels = mExtAFNumChannels;
    bufList.mBuffers[0].mData = data; // data is a pointer (short*) to our sample buffer
    bufList.mBuffers[0].mDataByteSize = samples * sizeof(short);

    // Crash occurs on this line:
    **err = ExtAudioFileRead(mExtAFRef, &loadedPackets, &bufList);**
    if (err) goto error;

    if (audio) {
        for (long c = 0; c < mExtAFNumChannels; c++) {
            if (!audio[c]) continue;
            for (long v = 0; v < numFrames; v++) {
                if (v < loadedPackets) audio[c][v] = (float)data[v*mExtAFNumChannels+c] / 32768.f;
                else audio[c][v] = 0.f;
            }
        }
    }

error:
    free(data);
    if (err != noErr) return err;
    if (loadedPackets < numFrames) mExtAFReachedEOF = YES;
    return loadedPackets;
}

我已经将Xcode说'exc_bad_access'的行加粗了

谢谢

最佳答案

您尝试使用的框架有问题。就我所知,它是内置框架,我认为您的xCode出了点问题。尝试重新安装。

关于iphone - 应用程式当机-无法找出原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11746911/

相关文章:

cocoa-touch - 如何获取两个日期之间的差异?

iphone - 如何在iPhone模拟器上推送视频?

ios - IOS的文件系统加密?

iphone - UITableview titleForHeaderInSection 显示不正确

android - 在多个平台上使用 Localytics - 单独的应用程序 key ?

ios - 从今天的日期和带有时间的字符串构造一个 NSDate

iphone - 在 'splitViewBarButtonItem' 类型的对象上找不到属性 'id<UISplitViewControllerDelegate>'

c++ - Mac 上的 Xcode 工具支持 c++11?

swift - UISwipeGestureRecognizer 不工作 Swift 4 SpriteKit

iphone - 更改导航栏的文本颜色 "prompt"?