Page 1 of 1

Problem with mergeAVCam

Posted: Fri Nov 16, 2018 11:26 am
by Peter@multidesk.se
Not again! :?

I'm trying to add a QR reader to my app. For this I use mergeAVCam and it works well, at least until I try to turn off the microphone permission, then the circus begins.

Because Apple does not release apps with incorrect permissions, this will be a big issue for me and for everyone who needs this feature.
I'm already facing this problem with "cameraControlSet" where I reported a bug earlier this year, which is still not fixed.

Solution someone?

///Peter

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:03 pm
by Mikey
I'm confused. Have you tried to release it and run into an issue?
mergAV requires both the microphone and the camera for BC scanning (even though it souldn't require the mic), as I think you know.

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:28 pm
by LiveCode_Panos
Hello all,

You have to set the microphone to empty before creating the camera:

Code: Select all

-- so this
mergAVCamSet "microphone", empty
-- before
mergAVCamCreate
Hope this helps,
Panos
--

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:35 pm
by Mikey
Panos,
So the microphone is no longer required for barcode scanning with mergav?

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:45 pm
by Peter@multidesk.se
Mikey,

Apple has decided not to release any apps on the App Store that require the user's permission if there is no good reason for it. For example, you must modify the pList to describe in detail why a certain function must be approved by the user.

Because the microphone is not needed to scan, Apple does not approve my app for the App Store.

///Peter

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:51 pm
by Peter@multidesk.se
Panos,

I have tried to set the microphone to empty before I create the camera... and I've tried to set it after ... no difference! :cry:


///Peter

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 3:55 pm
by Mikey
So you have already received a rejection from Apple, or you anticipate receiving one? I'm just curious.

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 4:19 pm
by Peter@multidesk.se
Mikey,

I've just had a similar problem with both cameraControlSet (microphone permission) and mobileStartTrackingSensor (incomplete description of permission) for positioning, so I'm pretty sure the "App review Mafia" does not let go of something like this...


///Peter

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 4:35 pm
by LiveCode_Panos
Hello all,

Two different reasons for rejection are discussed here:

1. Requesting privacy-related permissions (e.g. location, camera, microphone) with a "generic" description
2. Requesting permission for microphone without actually using it.

Issue 1 is worked around if you manually edit the plist and specify a "detailed" description string for the permission usage. For example change the generic "This app requires access to location" to "This app requires access to location to find restaurants nearby"

Issue 2 affects mergAV camera and cameraControl*.

For mergAV, the solution is to set the microphone to empty before creating the camera (see bug https://quality.livecode.com/show_bug.cgi?id=20900, which is now fixed)

For cameraControl, we are planning to implement a similar mechanism. See bug https://quality.livecode.com/show_bug.cgi?id=21438, not fixed yet).

@Mike
Yes the mic is no longer required for barcode scanning

@Peter
What version of LC are you using?
Could you post your script? Setting the mic to empty before creating the camera should not result in a dialog asking for microphone permission.

Best,
Panos
--

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 4:51 pm
by Mikey
Nice, Panos, thanks for all the detail.

Re: Problem with mergeAVCam

Posted: Fri Nov 16, 2018 5:44 pm
by Peter@multidesk.se
Panos,

LC Business 9.0.1

I uninstalled the app and tried over and over again with small changes in between, and suddenly the app did not ask for microphone permission. The only thing I changed is the order of the different "mergAVCamSet".

This is the code that now works!

Code: Select all

on openCard
   if the platform is "iphone"
   then
      mergAVRequestMediaAccess "video"
      mergAVCamSet "microphone", empty 
      mergAVCamSet "rect",the rect of grc "QR" of this cd
      mergAVCamCreate
      mergAVCamSet "visible","false"
      mergAVCamSet "high"
   end if
end openCard

///Peter

Re: Problem with mergeAVCam

Posted: Fri Jun 28, 2019 7:59 pm
by pkocsis
I assume the problem with iOS and cameraControl is that the current LC syntax does not provide a way to indicate whether audio is desired or not to the engine before the control is created, and therefore the control gets created by the engine (which includes ability to record audio) causing an insta-ask by iOS for microphone access.

If this is true, and there is no workaround via plist hacking, then wouldn't a true/false as a 2nd parameter to cameraControlCreate, specifying whether audio will be needed or not, give the engine the info it needs upfront when creating the control to either create it WITH audio capability or create the object without audio from the git-go, so that the permission is never triggered if not needed.....or does the underlying iOS api not work in that way? ...and/or is that too much of a bandaid type fix for this problem from LC's point of view.....?

I only ask because at the moment, any iOS app that uses cameraControl without needing audio (such as a stills-only camera app) will get rejected from the store due to the app asking for a permission that it does not really need......of which, of course, is the category that my app falls into :)

EDIT: *OR* is it simply a matter of manually editing the Info.plist to remove the permission for "microphone"? If so, do I build with LC, then manually edit the Info.plist in the generated .app bundle?