iPod touch4 8G MC540CH/A和iPod touch4 8G MD057CH/A区别

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iPod touch4 8G MC540CH/A和iPod touch4 8G MD057CH/A区别相关的知识,希望对你有一定的参考价值。

RT

这个··没有什么区别的啊!!
都是8G的ipod touch,而且都是大陆的行货版本啊!!!
参考技术A 喜欢哪个就买哪个 自己喜欢就好 参考技术B 不知到

iPod touch 检测不到耳机

【中文标题】iPod touch 检测不到耳机【英文标题】:iPod touch not detecting the earphone 【发布时间】:2013-11-14 06:04:59 【问题描述】:

我使用下面提到的代码来识别是否有任何“耳机”连接到 iOS 设备。

//find out, if any earphones are connected to the device
- (BOOL)isHeadsetPluggedIn 
    UInt32 routeSize = sizeof (CFStringRef);
    CFStringRef route;
    NSLog(@"Inside 'isHeadsetPluggedIn'");

    // Registers the audio route change listener callback function
    AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, (__bridge void *)(self));

    OSStatus error = AudioSessionGetProperty (kAudioSessionProperty_AudioRoute,
                                              &routeSize,
                                              &route);

    /* Known values of route:
     * "Headset"
     * "Headphone"
     * "Speaker"
     * "SpeakerAndMicrophone"
     * "HeadphonesAndMicrophone"
     * "HeadsetInOut"
     * "ReceiverAndMicrophone"
     * "Lineout"
     */

    if (!error && (route != NULL)) 
        NSString* routeStr = (NSString*)CFBridgingRelease(route);
        NSRange headphoneRange = [routeStr rangeOfString : @"Head"];
        NSLog(@"route %@", routeStr);
        if (headphoneRange.location != NSNotFound) 
            return YES;
        
     else 
        NSLog(@"Error %d while retrieving audio property", error);
    
    return NO;

以上代码适用于 iPad mini、iPad 和 iPhone 设备。 但在“iPod touch”设备中,“AudioSessionGetProperty”函数在检索音频属性时返回错误“错误“560557673”。 因此,它不会检测是否有任何“耳机”连接到“iPod touch”设备。

如何找出“iPod touch”设备上的“耳机”?

【问题讨论】:

【参考方案1】:

我可以使用下面提到的方法解决这个问题(从“SO”找到,但不记得地址)。

BOOL isAudioRouteAvailable(CFStringRef routeType)

    /*
     As of iOS 5:
     kAudioSessionOutputRoute_LineOut;
     kAudioSessionOutputRoute_Headphones;
     kAudioSessionOutputRoute_BluetoothHFP;
     kAudioSessionOutputRoute_BluetoothA2DP;
     kAudioSessionOutputRoute_BuiltInReceiver;
     kAudioSessionOutputRoute_BuiltInSpeaker;
     kAudioSessionOutputRoute_USBAudio;
     kAudioSessionOutputRoute_HDMI;
     kAudioSessionOutputRoute_AirPlay;
     */

    //Prep
    BOOL foundRoute = NO;
    CFDictionaryRef description = NULL;

    //Session
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^
        AudioSessionInitialize(NULL, NULL, NULL, NULL);
    );

    //Property
    UInt32 propertySize;
    AudioSessionGetPropertySize(kAudioSessionProperty_AudioRouteDescription, &propertySize);
    OSStatus error = AudioSessionGetProperty(kAudioSessionProperty_AudioRouteDescription, &propertySize, &description);
    if ( !error && description ) 
        CFArrayRef outputs = CFDictionaryGetValue(description, kAudioSession_AudioRouteKey_Outputs);
        CFIndex count = CFArrayGetCount(outputs);
        if ( outputs && count ) 
            for (CFIndex i = 0; i < count; i++) 
                CFDictionaryRef route = CFArrayGetValueAtIndex(outputs, i);
                CFStringRef type = CFDictionaryGetValue(route, kAudioSession_AudioRouteKey_Type);
                NSLog(@"Got audio route %@", type);

                //Audio route type
                if ( CFStringCompare(type, routeType, 0) == kCFCompareEqualTo ) 
                    foundRoute = YES;
                    break;
                
            
        
     else if ( error ) 
        NSLog(@"Audio route error %ld", error);
    

    //Cleanup
    if ( description ) 
        CFRelease(description);
    

    //Done
    return foundRoute;  

通过调用,

isAudioRouteAvailable(kAudioSessionOutputRoute_Headphones)

【讨论】:

以上是关于iPod touch4 8G MC540CH/A和iPod touch4 8G MD057CH/A区别的主要内容,如果未能解决你的问题,请参考以下文章

苹果MD057CH/A TOUCH 8G播放器 和 苹果播放器(Apple)iPod MC540CH/A TOUCH(8G)有啥不同 同价格买哪个

苹果 iPod touch 32GB MC544CH/A 4代与苹果 iPod touch 32GB MD058CH/A 4代有啥分别?MC与MD又代表啥

新手行货iphone 4.2.1 mc603ch 想升4.33 和越狱 求升级 越狱 备份SH 步骤 那步先???

为啥 Xcode 4.2 不支持运行 iOS 4.2.1 的第二代 iPod Touch

Macbook air (MC503CH)可以运行xcode4.2吗? 打算学ios开发应用.

如何共享通行证到 iPod