Log in or register to post comments

Crash on loadTexture and loadExternalTexture

June 16, 2017 - 6:14am #1

Hi everyone,

I'm updating an app for a customer and they insisted that we keep supporting FrameMarkers. So the whole project is updated but the Vuforia sdk has to stay at version 6.0.112. All the projectfiles are in Swift 3 right now except for the Vuforia view controller which is Objective-C++. The framemark detection works and I can create a 3d object but the app crashes when I load a texture for the 3d object. No error is being given it just crashes. Tried a bunch of different ways to load the image but that doesn't matter. Tried with different textures as well jpg, png, power of 2, non power of 2.

Has anyone experienced this before? Or does anyone have a working Swift version of Vuforia 6.0.112?

This is the line it crashes on:

 

- (BOOL)loadImage:(NSString*)filename

{

    BOOL ret = NO;

   

    // Build the full path of the image file

    NSString* resourcePath = [[NSBundle mainBundle] resourcePath];

    NSString* fullPath = [resourcePath stringByAppendingPathComponent:filename];

   

    // Create a UIImage with the contents of the file

    UIImage* uiImage = [UIImage imageWithContentsOfFile:fullPath];

   

    if (uiImage) {

        // Get the inner CGImage from the UIImage wrapper

        CGImageRef cgImage = uiImage.CGImage;

       

        // Get the image size

        width = (int)CGImageGetWidth(cgImage);

        height = (int)CGImageGetHeight(cgImage);

       

        // Record the number of channels

        channels = (int)CGImageGetBitsPerPixel(cgImage)/CGImageGetBitsPerComponent(cgImage);

       

        // Generate a CFData object from the CGImage object (a CFData object represents an area of memory)

        CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(cgImage));

       

        // Copy the image data for use by Open GL

        ret = [self copyImageDataForOpenGL: imageData];

        CFRelease(imageData); // the crash happens here

    }

   

    return ret;

}

These are the values of the vars in the debug window are in the image.

Help is much appreciated!

Thanks in advance!

Cheers,

David

AttachmentSize
Image icon Debug window33.03 KB
Log in or register to post comments