nielswh / iPhone-AR-Toolkit

An Objective-C augmented reality kit for iPhone. Forked from the iphonearkit.
http://www.agilitesoftware.com/blog
Other
275 stars 57 forks source link

iPhone Simulator acceptable like in original project #22

Closed kputters6 closed 11 years ago

kputters6 commented 11 years ago

The original project should be able to run on the simulator. The original does this. Was this removed due to a memory leak?

Blauesocke commented 11 years ago

Try this, I think just the deviceSupportsAR call does not support the simulator

{

    #if !TARGET_IPHONE_SIMULATOR

    // Go thru and see if the device supports Video Capture.
    NSArray *devices = [AVCaptureDevice devices];

    BOOL suportsVideo = NO;

    if (devices != nil && [devices count] > 0) {
        for (AVCaptureDevice *device in devices) {
            if ([device hasMediaType:AVMediaTypeVideo]) {
                suportsVideo = YES;
                break;
            }
        }
    }

    if (!suportsVideo)
        return NO;

    //TODO: Check to see if Device supports the Gyroscope (iPhone4 and higher)

    if(![CLLocationManager headingAvailable]){
        return NO;
    }

    return YES;

#else
    return YES;
#endif
}
nielswh commented 11 years ago

The reason is the updated version uses AVCaptureDevice that is not supported on iOS simulator (at least I could not get it to work)