gracenote sdk for music id无法在iOS 7设备上运行

时间:2013-11-16 20:21:53

标签: gracenote

这是我们所做的:

我们将框架添加到我们的项目和

在我们的一个班级中有以下内容:

GCSearchViewController.h

@interface GCSearchViewController : UIViewController<UISearchBarDelegate, GNSearchResultReady, GNAudioSourceDelegate>

GCSearchViewController.m

// - As per the web tutorial

#import <GracenoteMusicID/GNConfig.h>

#import <GracenoteMusicID/GNOperations.h>

#import <GracenoteMusicID/GNSearchResponse.h>

#import <GracenoteMusicID/GNSearchResult.h>

// - As per what we saw in the demo app

#import <GracenoteMusicID/GNRecognizeStream.h>

#import <GracenoteMusicID/GNAudioConfig.h>

#import <GracenoteMusicID/GNAudioSourceMic.h>

#import <AVFoundation/AVAudioSession.h>


…


#pragma mark - Gracenote Delegate


-(void) identifySong {

[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL response){

NSLog(@"Allow microphone use response: %d", response);

if (response) {

[GNOperations recognizeMIDStreamFromMic:self config:self.config];


}

}];

}


- (void) GNResultReady:(GNSearchResult *) result

{

GNSearchResponse *best = [result bestResponse];

if (![result isFailure] && (best.artist!=nil)) {

NSLog(@"Artist %@", best.artist);

NSLog(@"Song name %@", best.trackTitle);

} else {

NSLog(@"No Match");

}

}


- (void) audioBufferDidBecomeReady:(GNAudioSource*)audioSource samples:(NSData*)samples {

NSError *err;

err = [self.recognizeFromPCM writeBytes:samples];



if (err) {

NSLog(@"ERROR: %@",[err localizedDescription]);

}

}

此代码在模拟器中正常工作,但每当我们在设备上运行它(ipod touch 5th或iphone 5)时,应用程序就会出现以下错误:

2013-11-16 22:00:40.402 GC[1758:60b] 22:00:40.401 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)

Error: 0xffffd59d2013-11-16 22:00:52.904 Leaf[1758:60b] Allow microphone use response: 1

2013-11-16 22:00:52.925 GC[1758:60b] 22:00:52.925 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)

Error: 0xffffd59d2013-11-16 22:00:52.927 GC[1758:60b] *** Assertion failure in -[GNFingerprinterQueue startupTimerFired], /home/mobile/z-15003-ecma-3.2/cddb-clients/mmid/iOSMobileSDK/3.2/Classes/Private/GNFingerprinterQueue.m:291

2013-11-16 22:00:52.930 GC[1758:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'audioSource is nil'

*** First throw call stack:

(0x2fb66f4b 0x39e7b6af 0x2fb66e25 0x3050efe3 0x151849 0x1520e5 0x3054ae9b 0x2fb32183 0x2fb31653 0x2fb2fe47 0x2fa9ac27 0x2fa9aa0b 0x3478a283 0x3233e049 0x7b621 0x3a383ab7)

libc++abi.dylib: terminating with uncaught exception of type NSException

我们的应用程序针对iOS7 ...感谢任何关于如何使其工作的指示

1 个答案:

答案 0 :(得分:2)

获取麦克风硬件时出错。错误日志:

2013-11-16 22:00:40.402 GC [1758:60b] 22:00:40.401错误:[0x3c29f18c]&gt; aurioc&gt; 783:失败:-10851(启用1,outf&lt; 2 ch,0 Hz,Float32,非inter&gt; inf&lt; 1 ch,44100 Hz,Int16&gt;)

以上错误发生在两种情况下:

  1. 未正确配置麦克风硬件或
  2. RemoteIO无法获取硬件。
  3. 这通常在模拟器中发生,但如果麦克风无法访问,则可能在设备上发生。如果AVAudioSession未正确配置或搞砸了,也会发生错误。检查AVAudioSession配置并尝试删除iOS应用程序,重新安装它并进行干净的构建。