Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
10
Question by Thajocoth · Oct 12, 2016 at 04:17 AM · cameraiosrejectedplistunused

Why does Apple think my Unity project is trying to access the camera?

"This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data."

I feel like adding that key with the explanation of "This app does not use the camera" is not the correct solution... But I have no idea what could be seeming to use the camera.

It's a 2D Unity project. I'm updated to the latest of everything. I've written every line of code myself. I save & load four ints that I use as bitfields for persistent settings. I'm not using any services. (No ads, no in-app purchases, ect...) The only asset I've gotten from the asset store is a wav file. The app is fullscreen only and only supports the portrait and portrait upside down orientations. I set my export to 64 bit and iOS 8.0 or later.

My Google and Unity Answers searches haven't revealed any solutions. I have no starting point to debug from...

The rest of the code is fairly simple... What else can I look at?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Thajocoth · Oct 12, 2016 at 05:13 AM 0
Share

I've made a list of everything I use in the code that's even remotely external:


UnityEngine

System.Collections

$$anonymous$$onoBehaviour

Vector3

GameObject

Rigidbody2D

SpriteRenderer

Collider2D

Vector2

Time

Input

Random

Sprite

Particle$$anonymous$$anager

Screen

AudioSource

Color

ScreenOrientation

Animator

Transform

ParticleSystem

Resources

CircleCollider2D

BoxCollider2D

PlayerPrefs

System.Collections.Generic

System.Serializable

List


I don't see how any of that could be remotely related to the device's camera.

avatar image Thajocoth · Oct 12, 2016 at 05:02 PM 0
Share

I know that this sort of error happens if any files that XCode is even including accesses whatever it is (in this case the camera), even if the part of the file you're actually using doesn't use that item. Based on my research, this is where a lot of these false positives come from... But I'm not familiar enough with the internals of the Unity engine to know which of these structures comes from a file that could potentially access a device camera.

7 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by Frank84 · Jan 17, 2017 at 03:05 AM

I have released several iOS builds that do not use the camera with Unity 5.5.0f3, but upgrading to 5.5.0p4 causes this rejection when uploading the binary.

In terminal I ran: diff ./MyXcodeProjectOld/Classes ./MyXcodeProjectNew/Classes > diff1.txt diff ./MyXcodeProjectOld/Classes/Unity ./MyXcodeProjectNew/Classes/Unity > diff2.txt

and look what changed in /MyXcodeProjectNew/Classes/Preprocessor.h #define UNITY_USES_WEBCAM 1

set that to 0, increment build number, clean, archive, submit, success!

Just found an open issue for it too, which you all should vote on: https://issuetracker.unity3d.com/issues/ios-webcamtexture-and-microphone-classes-are-used-in-empty-unity-projects

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image andersemil · Jan 17, 2017 at 08:30 AM 3
Share

Awesome. I've made a small post build editor script which changes that line in Preprocessor.h and the builds work again. Thanks!

 using UnityEngine;
 using System.IO;
 using UnityEditor;
 
 public class iOSBuildPostProcessor
 {
     [PostProcessBuild]
     public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
     {
         if(target == BuildTarget.iOS)
         {
             Debug.Log ("<b>iOSBuildPostProcessor</b> OnPostProcessBuild");
 #if UNITY_5_5_0
             var targetfile = pathToBuiltProject + "/Classes/Preprocessor.h";
             var filecontents = System.IO.File.ReadAllText(targetfile);
             {
                 string seed = "#define UNITY_USES_WEBCA$$anonymous$$ 1";
                 string repl = "#define UNITY_USES_WEBCA$$anonymous$$ 0";
 
                 if (filecontents.Contains(seed))
                 {
                     Debug.Log("<b>iOSBuildPostProcessor</b> Removing faulty inclusion of CameraCapture");
                     filecontents = filecontents.Replace(seed, repl);
                 }
                 else
                 {
                     Debug.Log("Seed not found in file: " + seed);
                 }
             }
             System.IO.File.WriteAllText (targetfile, filecontents);
 #endif
         }
     }
 }
 

avatar image lolmaster2 andersemil · Feb 22, 2017 at 10:06 AM 0
Share

This is great! Thank you for sharing!

A few things I needed to do in order to make it work:

— Add: using UnityEditor.Callbacks; for [PostProcessBuild] to compile

— Create a C# script named iOSBuildPostProcessor and paste the code there. Place this file in a folder named "Editor"

— Change #if UNITY_5_5_0 to #if UNITY_5_5_1 (if you're using Unity 5.5.1 like me)

avatar image
1

Answer by junmin4 · Oct 18, 2016 at 08:39 PM

having the same problem, this is very frustrating, please let me know if you find a solution

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Thajocoth · Oct 18, 2016 at 09:19 PM 5
Share

As a stopgap solution, I've been removing the references to camera functionality from the exported UnityInterface.h, and deleting the contents of CameraCapture.h & CameraCapture.mm, so those are just empty files in the project... But that's not a real solution. It works, but is indicative of a bug in the Unity engine's iOS exporter.

avatar image junmin4 Thajocoth · Oct 18, 2016 at 10:10 PM 1
Share

Thanks so much! your work-around let me submit the app. I think this issue should be solved.. it's a bit.. weird..

avatar image
1

Answer by AmazingRuss · Oct 19, 2016 at 08:16 PM

I am also seeing this in a test project with one scene and one script that rotates a cube, all default build setting.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by ckrin · Oct 20, 2016 at 09:16 PM

Same here, got rejected because of this. Hoping for an update or a clean solution.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by andersemil · Jan 07, 2017 at 06:25 PM

Any resolve on this? Since upgrading to unity 5.5 we have the same issue, we're not using camera or photos in any way, but we get "invalid binary" when we upload to itunes connect and an email saying that we need to add NSCameraUsageDescription to info.plist. Please help if you can in any way. TIA

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image iterbit · Jan 07, 2017 at 07:14 PM -1
Share

This was already solved by Unity. I'm using Unity 5.5 and its working fine.

Probably you have some third party library which is causing this error. (Ex. Old admob sdk)

avatar image Thajocoth iterbit · Jan 11, 2017 at 12:40 AM 1
Share

That's incorrect. The current latest version of Unity still has this issue. It has not been fixed.

avatar image andersemil · Jan 11, 2017 at 10:01 AM 1
Share

I updated all plugins and I'm still getting this error with Unity 5.5.0p3. Only solution atm is to use @Thajocoth 's hack to remove references to CameraCapture. Really annoying

avatar image IvyKun · Jan 11, 2017 at 12:58 PM 1
Share

It was solved in unity 5.5.0f1 but is back in 5.5.0p3 :(

avatar image iterbit · Jan 13, 2017 at 02:26 AM 0
Share

Yes I can confirm it's back. It's working fine with Unity 5.5.0p1, but it's back with 5.5.0p4 (or any previous, I just downloaded new one).

Unity $$anonymous$$m, wtf?

avatar image helios · Jan 28, 2017 at 10:17 PM 0
Share

This most definitely is not fixed in the latest version - or in fact any version after 5.5.0p1.

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

117 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can not change " NSPhotoLibraryUsageDescription / NSPhotoLibraryAddUsageDescription" in postbuildprocess 2 Answers

Smooth Camera Rotation with Deceleration 1 Answer

How to load image from camera roll? 0 Answers

Why is my augmented reality app not working for ios? 0 Answers

Modify ARKit to use a Video Output instead of a Camera Output 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges