Log in or register to post comments

IOS APP Rejection - no camera detected after allowing Camera access

September 12, 2014 - 2:26am #1

"Furthermore, we found that your app exhibited one or more bugs, when reviewed on iPad running iOS 8 and iPhone 5s running iOS 8, on both Wi-Fi and cellular networks, which is not in compliance with the App Store Review Guidelines. Specifically, no camera detected after allowing Camera access."

Has anyone seen this before ?

 

My app was rejected and I am only using AR CAM but I am also using the snapshot functionality in the latest Vuforia 3.0. I see 3.0.9 is available now.

 

I will upgrade and see if it fixes my problem.  If anyone has some feedback on what else I can check in my app I would greatly appreciate it. I do not have any Apple devices with IOS 8 to test

 

regards

Leon

IOS APP Rejection - no camera detected after allowing Camera acc

December 5, 2014 - 7:32am #37

alvaroem 

 

AWESOME!

 

Thanks 

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

December 5, 2014 - 6:51am #36

I found the answer (well I hope it still apllies) in this thread:

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/ios-8-compatability-vuforia&sort=2

 

Thanks for the very useful feedback on that thread, very much appreciated 

IOS APP Rejection - no camera detected after allowing Camera acc

December 5, 2014 - 5:17am #35

Has anybody also found that regarless of approach to this issue if the app is backgrounded and the user goes to settings and makes a change to the camear access the app will crash and appears hung when reactivated from background?

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

November 5, 2014 - 2:44am #34

Hello everyone.

 

I just wanted to share my solution to all of you who has no idea about xCode and found a lot of problems trying to check camera permissions. After a lot of research I got what I think is a good solution. I have modified leonmoodley snippet to include a couple of interesting features (thank you btw, you saved my life!):

including a button to go directly to the settings page in the message shown to the user, and

- include a couple of variables set from xCode in PlayerPrefs that will be accesible from Unity in case you want, in example, modify your UI according to the user choice. 

Just go to the file UnityAppController.mm in the classes folder, and add this line as already described:

#import <AVFoundation/AVFoundation.h>

Look for the function didFinishLaunchingWithOptions and replace it with this one:

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    [[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"CameraCheckDone"];
    // 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)
             {
                 [[NSUserDefaults standardUserDefaults] setInteger: 1 forKey: @"CameraAccessGranted"];

                 // 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
                 [[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"CameraAccessGranted"];
                 UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Camera permission needed"
                                                                   message:@"Please change review your configuration and restart the app."
                                                                  delegate:self
                                                         cancelButtonTitle:@"OK"
                                                         otherButtonTitles:nil];
                 [message addButtonWithTitle:@"Settings"];
                 dispatch_async(dispatch_get_main_queue(), ^{
                     [message show];
                 });
             }
         }];
    }

    else {
        // iOS < 7 (camera access always OK)
        [[NSUserDefaults standardUserDefaults] setInteger: 1 forKey: @"CameraAccessGranted"];
        // Continue with app launch...
    }

    [[NSUserDefaults standardUserDefaults] setInteger: 1 forKey: @"CameraCheckDone"];
    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]);
    
    return YES;
}

 

You should add to the file also this function that will manage the "Settings" button click (thank you, Toywheel):

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
        if (buttonIndex == 1) // Settings clicked
        {
            if (&UIApplicationOpenSettingsURLString != NULL) {
                NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
                [[UIApplication sharedApplication] openURL:appSettings];
            }
        }
}

After this, you can access from Unity to this two variables stored in PlayerPrefs: CameraCheckDone and CameraAccessGranted, in such a way that you could do somthing like this:


        public IEnumerator CheckPrefs()
	{

		while  (!PlayerPrefs.HasKey("CameraCheckDone") || !(PlayerPrefs.GetInt("CameraCheckDone") == 1))
		{
			yield return new WaitForSeconds(0.25f);
		}

		while  (!PlayerPrefs.HasKey("CameraAccessGranted"))
		{
			yield return new WaitForSeconds(0.25f);
		}

		if (PlayerPrefs.GetInt("CameraAccessGranted") == 1)
		{
                        //Permissions granted
                }
                else
                {
                        //No camera permissions 
                }
        }

 

I hope this helps! Just remeber that I have no idea about xCode so my code is probably a mess. I just wanted to share my results in case I could save some time and pain to any other.

Happy coding!

Aernarion

IOS APP Rejection - no camera detected after allowing Camera acc

October 24, 2014 - 2:06am #33

Hi,

    Is there any news on an update for Vuforia?

I already answered this in my previous post. 

 

I would say 1/2 the time after pressing OK we get a black screen

 if you see black screen some times, but not all the time, this is because your App is trying to initialize Vuforia (QCAR) before the user had actually answered the Camera Access Dialog question (allow / don't allow). So, sometimes you're "fast enough" in answering and sometimes not.

To correct this, you can  implement a blocking condition in the code that guarantees that the camera dialog gets actually answered before allowing continuation towards Vuforia initialization;

this is already explained in detail here (in particular check the section iOS Unity Apps):

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

 

IOS APP Rejection - no camera detected after allowing Camera acc

October 23, 2014 - 11:39pm #32

Is there any news on an update for Vuforia?

We have the latest Vuforia with Unity, and we randomly have users that see the black screen after pressing OK to allow for camera access.

When I test by continuously changing the bundle ID and re-installing, I would say 1/2 the time after pressing OK we get a black screen, and the other half the correct camera feed. With black screen no tracking works.

Thanks,

Peter

IOS APP Rejection - no camera detected after allowing Camera acc

September 30, 2014 - 10:54am #31

The next release of Vuforia should address this.

No time estimate available at the moment.

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 30, 2014 - 8:27am #30

Alessandro , will there be a proper update of vuforia with all fixes soon? any estimate?

IOS APP Rejection - no camera detected after allowing Camera acc

September 24, 2014 - 6:38am #29

Thanks Alessandro, i know this way we can do..i was hoping some settings reset may do.

IOS APP Rejection - no camera detected after allowing Camera acc

September 23, 2014 - 12:01pm #28

As I said in my previous post, the easiest trick is to change the BundleID of the App in Xcode, e.g.:

com.myorg.myproject.MyApp

could be replaced (during testing) with:

com.myorg.myproject.test_001.MyApp

and then

com.myorg.myproject.test_002.MyApp

and so on...

not ideal, but easy and fast enough to do with Xcode.

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 23, 2014 - 11:50am #27

Resetting an app and start over to somehow get the initial user camera prompt would interest me too, but so far i could not get that to work.

I thought, it might be just the same as with Push Notifications. There the user also gets a prompt. Here the trick ist to:

1: unistall the app

2: restart the device

3: got to your date time settings and set it manually at least one day ahead

4: restart the device

5: Bingo.

 

Unfortunatly that does not work with Camera settings :-(

IOS APP Rejection - no camera detected after allowing Camera acc

September 23, 2014 - 11:45am #26

The dialog only shows up if the camera access has not yet been authorized (or denied) by the user;  i.e. the first time only.

Uninstalling and reinstalling the App will not do the trick of making the dialog appearing again, because iOS will remember that you replied already to the dialog for a given App.

For testing purposes, if you want to test various cases (e.g. what happens if you deny the first time, and what happesn if you allow the first time),

then you need to change the BundleID of your app in Xcode, for example, if your bundle ID is "com.myorg.myproject", then you can change it to "com.myorg.myproject_001" or something like that, so that your iOS will believe it's a new App

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 23, 2014 - 6:49am #25

How to get back the Allow camera access dialog? 

It is coming only for the very first time, after uninstall and install of same app the acess is not asked? 

Which settings are to be cleared to get it back?

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 11:53am #24

HI Guys

 

As promised. Heres the code snippet , nothing fancy its based on Alesandros code but the app wasn't rejected for the camera issue using this. 

 

UnityAppcontroller.mm

 

#import <AVFoundation/AVFoundation.h>

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    // 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
                
                //dispatch_async(dispatch_get_main_queue(), ^{
                 ///
                 //   [[[UIAlertView alloc] initWithTitle:@"AppTap!"
                 //
                 //                               message:@"AppTap doesn't have permission to use Camera, please change privacy settings"
                      
                //                              delegate:self
                      
                //                      cancelButtonTitle:@"OK"
                      
                //                      otherButtonTitles:nil] show];
                    
               // });
                
                UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Camera Permission"
                                                                  message:@"AppTap doesn't have permission to use Camera, please change privacy settings"
                                                                 delegate:self
                                                        cancelButtonTitle:@"OK"
                                                        otherButtonTitles:nil];
                [message show];
                

            }
        }];
    }
    
    else {
        // iOS < 7 (camera access always OK)
        // Continue with app launch...
    }
    
    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]);

    return YES;
}

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 11:20am #23

Toywheel wrote:

Everything is back to normal now.

 

Good to hear ;-)

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 10:42am #22

Hello,

i also foolwed the procedure described in Vuforias extra page (seams to be the official most detailed page).

However, we don´st use Vuforia from the first scene, instead somewhat later in the app.

 

so i tried to write a plugin called from unity to check for camera access earlier. Works but here is the strange thing:

After i call the methode and it finally hits this line:  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {

it 

it takes about 15 seconds on an iphone 5 to finally reach the answer block. That is way to long for a scenario, were i have such a methode call on a start game button. User touches it... nothing happens until 15 seconds are over and then finally i recieve a message like "please check your camera settings."

 

Edit:

my bad. we were starting the app with a video. This or the fact i tried to show alert messages at this time were the culprit. I ended up writing a bool into Playerprefs/NSUserDefaults and check this value once my unity scenes were ready to show alerts, to start the UIalertview via UnityPlugins.

I only leave this post here, in case somebody stumbles over the same issue.

Everything is back to normal now.

Edit 2:

In case you wonder how to lead the user directly to their camera settings: this is luckily possible again in iOs 8 by doing the following:

if (&UIApplicationOpenSettingsURLString != NULL) {
                    NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
                    [[UIApplication sharedApplication] openURL:appSettings];
}

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 1:43am #21

Hi all

I will share the code snippet with you guys later today. Keep an eye out. I have left the macbook at home today. We need some time apart or it may end up in the trash can.

 

alessandro,

thanks for the advice on IOS  we will give it a try. The tricky thing with apple is that  if they find a bug or two they will not complete the review and merely reject the app. When you fix those issues they give you more feedback on other things they dont like and then reject you again :) Got to love apple. though I find that because your app might not be reviewed by the same person, there are inconsistencies in the review process as well.

I think I will start a new thread on this topic, we had many issues and when we finally get onto the store it might be helpful to everyone to share this fun exeprience.

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 1:37am #20

Are you calling the dialog popup code using performselectoronmainthread ? If you don't, that might be the issue ...

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 1:27am #19

i was also able to get a popup if camera access was denied, but certain times, it was freezing the app for few seconds before the popup happening. I suspected some thread was running in the back ground. 

leonmodely can you please share you code?

IOS APP Rejection - no camera detected after allowing Camera acc

September 22, 2014 - 12:54am #18

Hi leonmoodley, don't worry we had many rejections for the same (stupid) reason. Apple doesn't care  about your clients, they care of their rules. I had serious conversations with the reviewer (I actually phoned apple in California about it). Sometimes you need to add a few "extra" stuff in your app just to make it more useful.

About the code I did it but I used unitySendMessage to trigger the event from Xcode to Unity, the problem is that this trick is not working on devices using iOS7 (gameobject not found), and is working really well on iOS8.

If you could share your code it would be greatm just to explore other solutions.

 

Cheers,

Ale.

IOS APP Rejection - no camera detected after allowing Camera acc

September 21, 2014 - 11:45am #17

We have implemented Allesandros fix for the camera permission check and included a popup dialog which prompts the user to resolve the camera permission issue. The pop exits the application and the user may restart the application. Apple seems okay with this ! Finally. 

Though they have failed us for our app not being useful :( . This is verty tricky one. The application is designed as per our customers specifications and they feel their customers would find it useful. Argh !

To the rest of you I wish you good luck. I can share the code sample if you require. Please let me know

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 3:34am #16

Hi, this works great now! I tried the app in any kind of scenario (permission ON, OFF, close and reopen, play and go back) and every time the camera is working.

Thanks for this!

Ale.

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 1:43am #15

Quick update:

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

this has been updated with a more comprehensive description of how to ensure to block on camera check before QCAR gets inited (to ensure that the camera does not get black).

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 1:29am #14

 

 

We submitted last night and have been fast tracked in the review process. Keep an eye for updates.

I hope our fixes work  as well,  We are a week late with the deployment of our application which was intended to be used at an industry event whichs ends today. Luckily for us we had an understanding customer.

This is why I prefer Android :)

 

Regards

Leon

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 1:26am #13

We experience the same kind of problem.

Even when the camera is allowed the AR part of the app has randomly a black screen and also randomly works other times.

Maybe the guidelines could be updated to get a hold on this so that the camera always works when it is allowed and doesn' t throw random a black screen?

We hope for a fix really soon!

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 12:34am #12

Thanks leonmoodley. Yes, please let us know how it goes; also, if Apple review provides additional feedback on potential additional corner cases (directly or indirectly related to the camera access issue),  then feel free to share those, as we can always update the guidelines to make them clearer or more complete, if need be.

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 12:22am #11

Hi guys

 

We have implemeneted allesandros pre check in our application and have re submitted to Apple.  I will keep you posted and post the code if we are successful.

 

 

Regards

Leon

IOS APP Rejection - no camera detected after allowing Camera acc

September 19, 2014 - 12:16am #10

the camera doesn't trigger and strangely, no errors from the console.

The bottomline of the guidelines in https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility

is that you need to make sure that the Vuforia (QCAR) intialization function does not get called until the camera access check is done; if you look at the code snippet in the article above, you will notice that there is a completionHandler with a '^(BOOL granted)' variable;   the completion handler is executed asynchronously, which means that your application may still go ahead with the initialization of Vuforia on a different thread (i.e. not the same thread as the completion handler), i.e. without waiting for the user granting access answer.   This can happen for instance if your app does not have an Introductory Page (such as an About Page or similar) and the application code goes straight to QCAR init.
 
To solve this, one easy way is for example to define a global variable such as 'BOOL CameraCheckWasDone' (initially set to NO),   then set it to YES when the completion handler completes....   and  then right before calling QCAR::init, add a waiting loop such as "while (!CameraCheckWasDone) {  } "   or similar to block and prevent QCAR from initializing until the CameraCheckWasDone  boolean flag becomes true.
 
I will also update the article to better clarify these aspects.
 

IOS APP Rejection - no camera detected after allowing Camera acc

September 18, 2014 - 6:51pm #9

Hi, I think we all have the same issue here. I got all of my apps from the appstore that works really random but most of the time the camera doesn't trigger and strangely, no errors from the console.

I did all the guides and fixes but even with the camera permissions it goes black.

I got one app rejected as well for the same reason.

Ale.

IOS APP Rejection - no camera detected after allowing Camera acc

September 17, 2014 - 11:27pm #8

see also more complete set of guidelines posted here:

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

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 17, 2014 - 1:26am #7

IOS APP Rejection - no camera detected after allowing Camera acc

September 16, 2014 - 12:51pm #6

Thanks everybody

Your help is greatly appreciated ,i will try these suggestions. What confused me  was that they said they had allowed camera access and still had an error.

I came across this post

https://developer.vuforia.com/forum/ios/ios7-problem

which seems similar to my own. How do I implement Nalin's code sample in Unity. I have looked at the scripting API's but I can't seem to see any solution.

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 16, 2014 - 8:28am #5

Hi, 

I have installed iOS8 on iPad Air and downloaded a few old apps to see if they worked and they did. One of the apps is using Unity 3.5.7 and Vuforia 2.8.7 and after allowing camera access it was working just fine. 

And yes, we also got an app rejected today by Apple for the same reason mentioned below. 

 

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 16, 2014 - 7:14am #4

What gfxguru says is correct;

if you allow the camera access (by answering Yes or OK to the iOS camera dialog), then the camera should show up and work normally;

but make sure to use the latest 3.0.9, indeed.

However, since the user might accidentally (or maybe intentionally) deny the camera access on the fist run, then the user would need to go to the device Settings > Privacy > Camera and re-enable the access manually, otherwise any subsequent runs would be affected by the originally denied access.

This is nothing complicated,  however it might be perceived as an annoying issue for some users in term of user experience (and many users probably might not even know about the existence of Settings > Privacy > Camera );

so, it is probably best to implement an additional runtime check in your application code (specifically for iOS8) to check whether the user has actually allowed or denied the camera access.

If you detect that the user denied the access, you may want for example show a UI Alert View (or other popup dialog) to warn the user and instruct / guide him on how to re-enable the camera access via Settings > Privacy > Camera.

This would avoid that the user feels "lost" (not knowing what to do) when seeing a black camera.

 

IOS APP Rejection - no camera detected after allowing Camera acc

September 16, 2014 - 6:04am #3

I also got my app rejected by apple. But on testing with iOS8 device, everything was working ok. The only difference is the camera access permission, if yes it works ok. If no you get black screen. This can be later changed in settings also.

I was using Unity 4.5 and 3.0.9 Vuforia Plugin.Were you using latest?

IOS APP Rejection - no camera detected after allowing Camera acc

September 12, 2014 - 6:15am #2
Log in or register to post comments