Topic locked

Black Screen on IOS Devices (Camera Mode)

November 9, 2014 - 9:03pm #1

HI Developers,

We are using Unity3D 4.5.0f6 with Vuforia 3.0.7 SDK for a project and for IOS we are using Xcode 5.1.1.

We are facing a balck screen feed from the camera while running the application. Application is not even turning on the device's camera.

We have tried to solve the issue ( Reference ) : https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility

But the problem is not resolve. still we are facing the same Black screen problem.

Any quick fix solution would be appreciated we are quite in a hurry!!!

Thank you.

Black Screen on IOS Devices (Camera Mode)

February 12, 2015 - 5:14am #25

@PPLIN,

that "tip" is also mentioned here (and it affects Vuforia 3.0):

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/unity-454-455-46-and-vuforia-ios

 

Please note that Vuforia 4.0 is not affected by the "UIInterfaceOrientation crash" mentioned above.

 

Black Screen on IOS Devices (Camera Mode)

February 11, 2015 - 6:47pm #24

I konow why.In iOS 7,NSString* orientation = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UIInterfaceOrientation"];This returns nill.Simple solutions, NSString * orientation = @"UIDeviceOrientationPortrait"; 

Black Screen on IOS Devices (Camera Mode)

February 9, 2015 - 11:49pm #23

Black Screen on IOS Devices (Camera Mode)

February 9, 2015 - 11:15pm #22

Migration could cause a broken project. Or is it safe to update to the vuforia 4 beta ?

Black Screen on IOS Devices (Camera Mode)

February 9, 2015 - 12:19pm #21

For those who might be interested in upgrading to Vuforia 4.0 (currently in "Beta" version), Vuforia 4.0 has built-in support for camera access check on iOS 8;

also, the Samples (native iOS and Unity) coming with 4.0 show how the camera access denied case can be handled.

See:

https://developer-beta.vuforia.com/downloads/sdk

https://developer-beta.vuforia.com/downloads/samples

https://developer-beta.vuforia.com/library/

https://developer-beta.vuforia.com/library/articles/Solution/Vuforia-40-Migration

 

Black Screen on IOS Devices (Camera Mode)

February 9, 2015 - 5:05am #20

Hi guys :)

I have followed your instructions on how to add the code, but i am getting errors in Xcode: 1. _CameraCheckDone", referenced from: 2. linker command failed with exit code 1 (use -v to see invocation).

Can you please tell me what i need to do or fix in order to make this work ?

 

Thank you

Black Screen on IOS Devices (Camera Mode)

November 26, 2014 - 1:18pm #19

If you're targeting iOS (Xcode project), you should build on Mac;   building an iOS / Xcode project from Windows (even if Unity allows it ) is not suppoted with Vuforia.

 

Black Screen on IOS Devices (Camera Mode)

November 25, 2014 - 4:10am #18

I am also getting a black screen in my ipod touch 4g. I built the xcodeproj in windows and run it in xcode 5.
is there a difference building an xcodeproj in unity windows and mac?

thanks for the response!

Black Screen on IOS Devices (Camera Mode)

November 21, 2014 - 3:13am #17

Black Screen on IOS Devices (Camera Mode)

November 21, 2014 - 2:47am #16

@AlessandroB,  https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/unity-454-455-and-vuforia-ios is directing to Account information page. Could you please update the link.

Thank you. 

Black Screen on IOS Devices (Camera Mode)

November 13, 2014 - 12:20am #15

If you read here;

https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility

it tells you to add this snippet in the application: didFinishLaunchingWithOptions: method:

 

1
2
// add this global variable (e.g. in AppDelegate.m)
BOOL CameraCheckDone = NO;

Then you can perform the camera access check proactively using some code like to the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Determine camera access on iOS >= 7
if ([AVCaptureDevice respondsToSelector:@selector(requestAccessForMediaType:completionHandler:)]) {
    // Completion handler will be dispatched on a separate thread
    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
        if (YES == granted) {
            // User granted access to the camera, continue with app launch
       }
        else {
            // User denied camera access
            // warn the user that the app requires camera access
            // and ideally provide some guidance about the device Settings
        }
 
        // Here mark that the camera access check has been completed
        // (no matter if the 'granted' is YES or NO)
        CameraCheckDone = YES;
    }];
}
 
else {
    // iOS < 7 (camera access always OK)
 
    CameraCheckDone = YES;
    // Continue with app launch...
}

and then to add this code in the UnityAppController.mm:

NSLog(@"Waiting for Camera Access Check to be completed...");
while (!CameraCheckDone) { }
NSLog(@"OK. Camera Check was completed. Can continue.");

 

 

Also, make sure to Clean and rebuild.

But if you have already denied the access in a previous run, you need to go to Settings > Privacy > Camera and re-enable the camera access for your app.

 

Black Screen on IOS Devices (Camera Mode)

November 12, 2014 - 10:38pm #14

Ya @AlessandroB, Your solution is working to solve the EXC_BAD_ACCESS error.

I have built Vuforia SDK 3-0-10 video sample with Unity3d 4.5.5 and Xcode 6.1. Still am getting the Black Screen issue.

To solve this  i have follwed link : https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility and done changes in UnityAppController.mm  as mentioned in comment #3 . but no luck !!!

 

 

Black Screen on IOS Devices (Camera Mode)

November 12, 2014 - 4:32am #13

Black Screen on IOS Devices (Camera Mode)

November 12, 2014 - 1:15am #12

I downloaded video sample 3.0.10 and built it in XCode 6.1 (unity 4.5.5) and am getting EXC_BAD_ACCESS error. Upon a little search on forums I found a couple of links which mention that this error is because of orientation and so tried to open the mentioned link, https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/unity-454-and-vuforia-ios

But this link redirects me to my user account page. Could you please update the link.

Also, is there a timeline when is Vuforia releasing the new version with black screen on camera mode fix and this issue fix?

Thanks!

Black Screen on IOS Devices (Camera Mode)

November 12, 2014 - 1:09am #11

Am attaching the EXC_BAD_ACCESS error screenshot for reference.

we are using Unity3d 4.5.5 and vuforia SDK 3-0-10 video sample and Xcode 6.1 .

 

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 9:18pm #10

Thanks for your input.

I was reluctant to upgrade unity because we export 3D models as asset bundles (unity3d format) and download them in the app on the fly. Unity does not have forward as well as backward compatibility when it comes to asset bundles. Updating all the asset bundles everytime with new Vuforia SDK version or Unity or XCode version becomes a pain. But now with iOS 8.1, I think migration to new versions is inevitable. Will try integrating the project in all new versions, vuforia 3.0.9, unity 4.5.5 and build it in xcode 6.1.

I hope there are no major changes for sometime now.

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 8:31pm #9

Let me check with updated unity 4.5.5 version.

Thanks for your response. 

 

 

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 6:49am #8

Forgot to mention: as you mentioned that you are using Unity 4.5.0

in order to correctly work on iOS 8 targets, you should upgrade to the latest Unity 4.5.5 and to Xcode 6.

In fact, there have been several bug-fixes related to iOS 8 (and Xcode 6) starting in Unity 4.5.1 and up to Unity 4.5.5, as you can see in the releease notes of the most recent Unity versions:

http://unity3d.com/unity/whats-new/unity-4.5.1

http://unity3d.com/unity/whats-new/unity-4.5.3

http://unity3d.com/unity/whats-new/unity-4.5.4

http://unity3d.com/unity/whats-new/unity-4.5.5

So, it appears that 4.5.0 was still affected by a certain amount of bugs or issues with iOS 8, which have been corrected in the subsequent versions (the latest and most comprehensive of which is 4.5.5, as of today).

 

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 6:41am #7

Are you targeting an iOS 8 device, but you are building with iOS SDK 7 in Xcode 5 ? AFAIK, iOS SDK 8 requires Xcode 6.

See also here:

http://stackoverflow.com/questions/25815035/debug-ios-8-device-with-xcode-5-1-1

 

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 6:03am #6

My project is for iOS 8 built in XCode 5.1.1 and Unity 4.5.0 and Vuforia video sample 3.0.7.

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 5:49am #5

My project is for iOS 8 built in XCode 5.1.1 and Unity 4.5.0 and Vuforia video sample 3.0.7.

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 5:34am #4

Hi all,

the reference article in the link you mention only applies when targeting iOS 8 devices and/or building in Xcode 6:

( https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility)

if you are seeing black camera on iOS 6 or iOS 7 target devices (as vamshi reported that they are developing still with Xcode 5.1.1), then this is probably another issue (NOT related to the iOS 8 and Xcode 6 compatibility).

In this case, you probably need to reproduce it first with the Sample Apps (using the Vuforia samples correspinding to the SDK version you are using); if it only happens on your App, then you should first debug it and provide some hints on how to reproduce it and / or some useful  log messages describing the error condition  if possible.

 

Black Screen on IOS Devices (Camera Mode)

November 11, 2014 - 3:25am #3
Hai All,

I have done changes according to this reference link:  https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility#top

still am facing the same black screen issue. Problem is not solved.

Can anyone help!!!

Below is the UnityAppController.mm of my Xcode 5.1.1 (i have edited).




#import <OpenGLES/ES2/glext.h>
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
#import <AVFoundation/AVFoundation.h>


 BOOL CameraCheckDone;
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{   
    
	printf_console("-> applicationDidFinishLaunching()\n");
	// get local notification
	if (&UIApplicationLaunchOptionsLocalNotificationKey != nil)
	{
		UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
		if (notification)
			UnitySendLocalNotification(notification);
	}

	// get remote notification
	if (&UIApplicationLaunchOptionsRemoteNotificationKey != nil)
	{
		NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
		if (notification)
			UnitySendRemoteNotification(notification);
	}

	if ([UIDevice currentDevice].generatesDeviceOrientationNotifications == NO)
		[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

	[DisplayManager Initialize];

	_mainDisplay	= [[[DisplayManager Instance] mainDisplay] createView:YES showRightAway:NO];
	_window			= _mainDisplay->window;

	[KeyboardDelegate Initialize];

	[self createViewHierarchy];
	[self preStartUnity];
	UnityInitApplicationNoGraphics([[[NSBundle mainBundle] bundlePath]UTF8String]);

	
    
    
    
    // Determine camera access on iOS >= 7
    if ([AVCaptureDevice respondsToSelector:@selector(requestAccessForMediaType:completionHandler:)]) {
        // Completion handler will be dispatched on a separate thread
        [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
            if (YES == granted) {
                // User granted access to the camera, continue with app launch
            }
            else {
                // User denied camera access
                // warn the user that the app requires camera access
                // and ideally provide some guidance about the device Settings
            }
            
            // Here mark that the camera access check has been completed
            // (no matter if the 'granted' is YES or NO)
            CameraCheckDone = YES;
        }];
    }
    
    else {
        // iOS < 7 (camera access always OK)
        
        CameraCheckDone = YES;
        // Continue with app launch...
    }
    
    return YES;
    
    
}



- (void)applicationDidBecomeActive:(UIApplication*)application
{
	printf_console("-> applicationDidBecomeActive()\n");

	if(_unityAppReady)
	{
		if(_didResignActive)
			UnityPause(false);
	}
	else
	{
	NSString* orientation = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UIInterfaceOrientation"];

     while (!CameraCheckDone) { }
        
	QCARUnityPlayer::getInstance().QCARInit([orientation UTF8String]);
	QCARUnityPlayer::getInstance().QCARSetOrientation([_unityView contentOrientation]);
		[self performSelector:@selector(startUnity:) withObject:application afterDelay:0];
	}

	_didResignActive = false;
}

Black Screen on IOS Devices (Camera Mode)

November 9, 2014 - 9:15pm #2

Same with me. I tried to solve the problem with the same reference but no luck.

Topic locked