Created attachment 14992 [details]
Example project demonstrating incorrect behavior
Our application uses a UIImagePickerController with SourceType of Camera to allow our users to capture photos in the application.
In versions of iOS 8, a bug causes Camera preview to be black. Some of the potential problems are explained on Stack Overflow:
We noticed the builds that include Calabash would have the blank preview problem every other time a UIImagePickerController is opened. Specifically, the first time the Camera capture is used, the preview will work and the image will be captured successfully. The second time, the preview will be entirely black, but it will still be able to capture the image. It displays black every two previews.
We tracked it down to the following call, which fixes it if removed:
One person on Xamarin Forums also ran into this with Calabash:
An example “CameraTesting” application that demonstrates the problem described here is attached. If you click to launch the camera twice in a row, the preview will be black the second time.
Removing the Calabash.Start() call at AppDelegate:16 fixes this.
It seems this could be caused by many different problems, but one possibility is interaction with UIKit from a background thread.
Please let me know if any additional information would be helpful.
Are you distributing builds to users that include Xamarin.Calabash.Start ()? Normally we would expect a release build to distributed to users so that Calabash.Start () is not called since the #if def is only defined for debug builds. Also I believe Apple will reject an app if it calls Calabash.Start.
Or are you trying to use Xamarin.UITest with the camera and the preview is blank and that is causing you a problem with your tests?
We are not distributing builds with the Calabash.Start call and do not have a problem with our tests because of this, but we were using the same build configuration for manual QA testing and automated tests.
We have added a separate configuration to our builds for UITests to work around this.
We were also concerned what else may be broken by whatever is causing this, as I believe it is a strange interaction to be seeing.
I have opened an issue #928 with the UITest team about this.
We have investigated this issue and found that linking the Calabash/Test Cloud Agent or calling Calabash.Start does not cause this issue.
> In versions of iOS 8, a bug causes Camera preview to be black.
We found that regardless of whether or not Calabash/Test Cloud Agent is linked, the preview window is not visible on every other launch.
We tested against a new solution and the solution that you provided.
We also tested against a native iOS project. We could not reproduce "missing preview image" in the native iOS project.
We don't know where the problem is, but linking Calabash or the Test Cloud Agent is not the cause.
@Ryan - Can you attach the information from the Xamarin Studio about dialog - Show Details page?
If the image preview problem does not occur with a native iOS project then it may be a problem with Xamarin.iOS. Reassigning to the iOS team to take a look.
@Joshua, can you zip up and attach the XS and Xcode projects you created?
Created attachment 15964 [details]
Xamarin Studio Camera Test - Glenn Wilson and Joshua Moody
@Rolf I attached the Xamarin Studio solution we used for testing.
The Objective-C implementation will be part of our public test app. I will add a link once we have pushed the feature to GitHub.
Reopened bug, sample is attached
@Joshua, do you have the Objective-C implementation for your test case now?
@Rolf Not yet. I think I might have deleted the local branch. This has a very low priority for the Frameworks team. :/ Apologies. If you want this to be a priority, please contact Glenn Wilson.