Problem with mergeAVCam

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Problem with mergeAVCam

Post by Peter@multidesk.se » Fri Nov 16, 2018 11:26 am

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
/*Whats all the fuss with c# ?*/

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Problem with mergeAVCam

Post by Mikey » Fri Nov 16, 2018 3:03 pm

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.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Problem with mergeAVCam

Post by LiveCode_Panos » Fri Nov 16, 2018 3:28 pm

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
--

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Problem with mergeAVCam

Post by Mikey » Fri Nov 16, 2018 3:35 pm

Panos,
So the microphone is no longer required for barcode scanning with mergav?

Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: Problem with mergeAVCam

Post by Peter@multidesk.se » Fri Nov 16, 2018 3:45 pm

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
/*Whats all the fuss with c# ?*/

Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: Problem with mergeAVCam

Post by Peter@multidesk.se » Fri Nov 16, 2018 3:51 pm

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
/*Whats all the fuss with c# ?*/

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Problem with mergeAVCam

Post by Mikey » Fri Nov 16, 2018 3:55 pm

So you have already received a rejection from Apple, or you anticipate receiving one? I'm just curious.

Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: Problem with mergeAVCam

Post by Peter@multidesk.se » Fri Nov 16, 2018 4:19 pm

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
/*Whats all the fuss with c# ?*/

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Problem with mergeAVCam

Post by LiveCode_Panos » Fri Nov 16, 2018 4:35 pm

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
--

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Problem with mergeAVCam

Post by Mikey » Fri Nov 16, 2018 4:51 pm

Nice, Panos, thanks for all the detail.

Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: Problem with mergeAVCam

Post by Peter@multidesk.se » Fri Nov 16, 2018 5:44 pm

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
/*Whats all the fuss with c# ?*/

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Problem with mergeAVCam

Post by pkocsis » Fri Jun 28, 2019 7:59 pm

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?

Post Reply

Return to “iOS Deployment”