freshplanet / ANE-ImagePicker

Air Native Extension for mobile camera and gallery features (iOS + Android)
Apache License 2.0
80 stars 48 forks source link

Not working on iOS7 [With solution] #15

Open tangamampilia opened 11 years ago

tangamampilia commented 11 years ago

Hi, I noticed a bug with the new iOS7. If you try to show up the pickers then nothing happens. Add this lines to fix it in the AirImagePicker.m:

if (rootViewController == nil) {
        NSArray *windows = [UIApplication sharedApplication].windows;
        for (int i=0; i<windows.count; i++) {
            if ([[windows objectAtIndex:i] isKindOfClass:[UIWindow class]]) {
                rootViewController = ((UIWindow *)[windows objectAtIndex:i]).rootViewController;
                break;
            }
        }
    }

Before this line:

if (sourceType == UIImagePickerControllerSourceTypeCamera || UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

After that, we need to recompile the ANE. Thanks.