alexcrichton / AudioStreamer

A streaming audio player class (AudioStreamer) for Mac OS X and iPhone.
69 stars 22 forks source link

Project does not even compile for iOS target #18

Closed ghvillasboas closed 12 years ago

ghvillasboas commented 12 years ago

Hi there!

Your project has some issues while compiling the iOS target. AudioStreamer/AudioStreamer.m:651:52: Unexpected type name 'BOOL': expected expression AudioStreamer/AudioStreamer.m:745:21: Expected method to read dictionary element not found on object of type 'NSDictionary ' AudioStreamer/AudioStreamer.m:753:50: Expected method to read dictionary element not found on object of type 'NSDictionary '

MACOS runs ok.

Bo98 commented 12 years ago

Literals is broken for BOOLs and subscripting is unsupported on iOS 5. Both should work in the upcoming iOS 6.

There was a previous report here: https://github.com/alexcrichton/AudioStreamer/issues/7


As getting it to compile you would have to do the following:

1) Change the @YES to @(YES) and @NO to @(NO), or if you want to maintain compatibility with both iOS 5 and 6, place this in your .pch or at the top of the AudioStreamer file:

    #ifndef __IPHONE_6_0
        #if __has_feature(objc_bool)
            #undef YES
            #undef NO
            #define YES __objc_yes
            #define NO __objc_no
        #else
            #undef YES
            #undef NO
            #define YES ((BOOL)1)
            #define NO ((BOOL)0)
        #endif
    #endif

2) Create a header file (no need for implementation) for subscripting support for < iOS 6.

#import <Foundation/Foundation.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 60000

@interface NSObject(subscripts)

- (id)objectAtIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
- (id)objectForKeyedSubscript:(id)key;

@end

#endif

In short: it's a problem with the SDK. It should go away in iOS 6.

ghvillasboas commented 12 years ago

Thank you very much for your quick reply. Made all the suggested changes on the code. Compiled without any problem now.

The problem now is when playing a stream. I get an warning message and a strange crash.

_2012-09-07 20:47:58.103 Pacha[77856:1d03] 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/Xcode44-DP7.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-09-07 20:47:58.120 Pacha[77856:1d03] 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/Xcode44-DP7.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_

Making some profiles and testing it with iOS 6, I got a exception break point on this block of code:

  if (state_ == AS_WAITING_FOR_DATA) {
    /* Once we have a small amount of queued data, then we can go ahead and
     * start the audio queue and the file stream should remain ahead of it */
    if (bufferCnt < 3 || buffersUsed > 2) {
      err = AudioQueueStart(audioQueue, NULL); // Crash happens in this line (AudioStreamer.m line 830)!
      if (err) {
        [self failWithErrorCode:AS_AUDIO_QUEUE_START_FAILED];
        return -1;
      }
      [self setState:AS_WAITING_FOR_QUEUE_TO_START];

Any ideas?

Thanks!

alexcrichton commented 12 years ago

You may find issue #4 of some use.

ghvillasboas commented 12 years ago

Yep Alex. I think you're right about being some bug on the simulator. Maybe it should be good to fire a console log when the user runs the code using the simulator, like push notification and iCloud APIs does.

Great job. Thanks.