Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23306] Include auto-focus-camera in UIRequiredDeviceCapabilities to fix focus issues on some iPhone/SDK combinations

GitHub Issuen/a
TypeBug
PriorityHigh
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS, Tooling
Labelsn/a
ReporterTim Poulsen (ACV)
AssigneeChris Barber
Created2016-05-03T13:51:40.000+0000
Updated2016-06-30T12:41:38.000+0000

Description

I know you hate tickets like this...I can't provide a reproduceable test case. But I'm going to file it anyway so that it's documented for someone else who might encounter the same issue. I’ve been struggling with camera focus issues on iOS. In our app, focus on some iPhones is fixed at 15-20 cm. But I can’t reproduce it outside our app. You can try with the attached, which mimics our app's use of the camera. On affected devices, it doesn't matter whether you use the full-screen camera or the camera with an overlay like our app uses. And, it's not consistent to device type...some iPhone 6's are affected, others are not for example. But on those devices affected, the issue is constant. On my iPhone 5, the camera is always fixed focus with our app (though works fine in other apps, native camera app, etc.). Adding auto-focus-camera to the UIRequiredDeviceCapabilities in tiapp.xml seems to have fixed it. I would assume that that key is added automatically to the plist whenever you use the camera. But, maybe not?
<key>UIRequiredDeviceCapabilities</key>
<array>
  <string>auto-focus-camera</string>
  <string>front-facing-camera</string>
  <string>camera-flash</string>
  ...

Attachments

FileDateSize
app.js2016-05-03T13:49:22.000+00002767

Comments

  1. Tim Poulsen (ACV) 2016-05-03

    BTW, this problem started happening sometime around the switch to the 5.x line of SDKs. We didn't have this problem in the past. I don't have record of an exact date/release when the problem appeared.
  2. Sharif AbuDarda 2016-05-03

    Hello, The issue is fixed when "auto-focus-camera" is defined in "UIRequiredDeviceCapabilities" in tiapp.xml. For referance see https://developer.apple.com/library/ios/qa/qa1397/_index.html regards, Sharif.
  3. Tim Poulsen (ACV) 2016-05-03

    I'm not sure why you would resolve this as "Fixed" when you have done nothing. I filed this as a bug because: a) auto-focus-camera should be added to the plist automatically when you use the camera, but it is apparently not. And b) if developers need to add that key, it should be documented, which it is not. So, either this is an SDK bug (key not added when it should be) or a docs bug (it's not documented that developers need to add it).
  4. Sharif AbuDarda 2016-05-03

    Hello, The issue here is camera won't focus on some of the devices (random devices, all of are iphone 6 and up), as the reporter mentioned . The issue started in SDK 5.x and up. To avoid that issue you need to define "auto-focus-camera" key in "UIRequiredDeviceCapabilities" in tiapp.xml. But this should automatically be added in there when camera is used. And if that's not the case, the solution should be added to the docs for developers to follow. Thanks, Sharif.
  5. Tim Poulsen (ACV) 2016-05-03

    It should be documented in the _Appcelerator Ti.Camera_ documentation that this is required. In most cases, Titanium developers do not need to specify device capabilities (or Android uses-permission settings) because these are typically handled by the Titanium build scripts. The fact that this required device capability is not handled automatically, and not documented is a *Titanium bug*
  6. Chris Barber 2016-05-04

    We need to punt this to Titanium 6. The iOS build currently writes the Info.plist before it copies and analyzes the JavaScript files, so that means it doesn't know which Titanium APIs are even being used until much later in the build. I'm not confident that we can simply move the writing of the Info.plist after the resources have been processed without introducing other issues. Given we have a workaround today whereby users can just set the UIRequiredDeviceCapabilities in tiapp.xml, I believe this can wait until Titanium 6.
  7. Tim Poulsen (ACV) 2016-05-04

    That's fine by me
  8. Fokke Zandbergen 2016-05-05

    [~cbarber] makes sense. I've created TIDOC-2516 to request it to be added to docs in the meanwhile.
  9. Tim Poulsen (ACV) 2016-05-12

    I just tried submitting my app update with the new auto-focus-camera device capability and was blocked. _The app's Info.plist can't contain values for the UIRequiredDeviceCapabilities key that would prevent this app from opening on any iOS device that was supported by previous versions. For more information, see Understanding the UIRequiredDeviceCapabilities Key._ So, any fix you might do needs to be for only new apps not existing ones.
  10. Fokke Zandbergen 2016-05-13

    Wow, that makes this even more critical if only when you first publish the app you can set this capability.
  11. Tim Poulsen (ACV) 2016-05-13

    Since I can't add the plist tag, I would love to hear other options for fixing the focus issues we're seeing.
  12. Fokke Zandbergen 2016-05-15

    I'm reading up on this issue which is actively discussed by Xcode iOS developers as well: * http://stackoverflow.com/questions/28107124/the-apps-info-plist-cant-contain-values-for-the-uirequireddevicecapabilities-k/32940562 * https://devforums.apple.com/message/1137785#1137785 * http://oleb.net/blog/2011/12/uirequireddevicecapabilities-cannot-be-changed-in-app-updates/ The following quote from Apple might be hint on a possible workaround: {quote}Engineering has determined that this issue behaves as intended based on the following information: Developers can add restrictions to UIRequiredDeviceCapabilities on app updates provided any device that is dropped cannot support the min os version specified.{quote} You could try to add the key but also increase the [min-ios-ver](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference-section-29004921_tiapp.xmlandtimodule.xmlReference-min-ios-ver) and hope that the device(s) that don't support the capability will also not support the minimum iOS version, which should allow you to add the key still.
  13. Tim Poulsen (ACV) 2016-06-30

    Not including this capability has permanent and damaging consequences for iOS app developers. If you publish your app without understanding that you have to manually add this flag, you're stuck. You will be permanently incapable of fixing the blurry photos your users will take without switching app IDs / app names (i.e. publishing a new app). Given that Titanium is supposed to make app publishing easier, not more difficult for developers, I don't see how you can put off fixing this issue. At minimum, there should be a huge warn message in the build logs, maybe even a dialog in Studio that is shown if the developer uses the Ti.Camera module without setting the UIRequiredDeviceCapabilities flag.

JSON Source