Apple denied my app due to position of navigator.camera.getPicture() popup

463 views
Skip to first unread message

WootWoot1234

unread,
Mar 7, 2012, 2:25:45 AM3/7/12
to phon...@googlegroups.com
Hey Guys,

Just got denied from apple.  :(  This is what they wrote:

We found that your app does not comply with the Apple iOS Human Interface Guidelines, as required by the App Store Review Guidelines.

Specifically, we noticed your app contained popover elements that didn't point to the element that revealed them. To avoid user confusion, a popover element's arrow should point to the element that revealed it. When the photos button is selected in your app, the popover appears at the top of the screen, not over the button with the arrow pointing toward the button. See the attached screenshot.

For more information, please review the iOS UI Element Usage Guidelines section of the iOS Human Interface Guidelines. 

I'm using navigator.camera.getPicture() to select an image from the photo album.  When I call it, it puts a popup in the in the top right of the screen with an arrow pointing to the left (see screen shot).  Anyone know how I can position the popup window and point the arrow down?  I don't mind editing the objective c.

Thanks,
Tom
dj.anvjadrq.png

Giacomo Balli

unread,
Mar 7, 2012, 3:17:15 AM3/7/12
to phonegap
In order to solve this... where do you find the .m files of the
PhoneGap framework? Are they all bundled in the .framework?
Is there a way of editing them?


On Mar 7, 8:25 am, WootWoot1234 <tkro...@gmail.com> wrote:
> Hey Guys,
>
> Just got denied from apple.  :(  This is what they wrote:
>
> We found that your app does not comply with the Apple iOS Human Interface
>
> > Guidelines<https://developer.apple.com/library/ios/#documentation/UserExperience...>,
> > as required by the App Store Review Guidelines<https://developer.apple.com/appstore/resources/approval/guidelines.html>
> > .
>
> > Specifically, we noticed your app contained popover elements that didn't
> > point to the element that revealed them. To avoid user confusion, a popover
> > element's arrow should point to the element that revealed it. When the
> > photos button is selected in your app, the popover appears at the top of
> > the screen, not over the button with the arrow pointing toward the button.
> > See the attached screenshot.
>
> > For more information, please review the iOS UI Element Usage Guidelines
> > section of the iOS Human Interface Guidelines<http://developer.apple.com/library/ios/documentation/UserExperience/C...>
> > .
>
> I'm using navigator.camera.getPicture() to select an image from the photo
> album.  When I call it, it puts a popup in the in the top right of the
> screen with an arrow pointing to the left (see screen shot).  Anyone know
> how I can position the popup window and point the arrow down?  I don't mind
> editing the objective c.
>
> Thanks,
> Tom
>
>  dj.anvjadrq.png
> 652KViewDownload

Tom Krones

unread,
Mar 7, 2012, 3:20:15 AM3/7/12
to phon...@googlegroups.com
I assume it's all in the camera.h and camera.m files.

Tom

Devgeeks

unread,
Mar 7, 2012, 4:32:54 PM3/7/12
to phon...@googlegroups.com
The Camera.h/m files are only available if you get the source from GitHub or Apache's git.

I am writing a tutorial at the moment on how to take an existing PhoneGap/Cordova API and use it to make your own plugin-version... but it's not finished.

Until then, all you would need to do is get the PhoneGap/Cordova source, edit Camera.h/m, then recompile it into a new installer.

Tom Krones

unread,
Mar 7, 2012, 5:05:17 PM3/7/12
to phon...@googlegroups.com
I have no problem getting the code and recompiling it, I've done it before.  Do you know what I need to change to move the popup and change the arrow direction?  I just don't know the correct object or method that needs changing.

Thanks,
Tom

--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com

WootWoot1234

unread,
Mar 8, 2012, 1:26:18 AM3/8/12
to phon...@googlegroups.com
Bump..
Tom

Kerri Shotts

unread,
Mar 8, 2012, 1:53:10 AM3/8/12
to phon...@googlegroups.com
In camera.m (1.5.0):

101             [ self.pickerController.popoverController presentPopoverFromRect:CGRectMake(0,32,320,480)
102                                                                       inView:[self.webView superview]
103                                                     permittedArrowDirections:UIPopoverArrowDirectionAny 
104                                                                     animated:YES]; 

I suspect that the CGRectMake is doing it; this rectangle appears to really only be valid for an iPhone/iPod Touch in portrait orientation. presentPopoverFromRect attempts to point the arrow at this rectangle (which is in the upper-left quadrant of the iPad), and voila, you're pointing at the wrong thing. 

(Note: on the iPhone, this isn't a big deal: these just pop up action sheets, not popovers. But on the iPad... different story.)

To fix, either hardcode the value in the code, OR, better, add the ability to send in the rectangle parameters yourself, in case you have more than one screen position this can happen from.

Regardless, the values should be the rectangle surrounding the icon/button used to generate the popover -- then the arrow will point in the correct direction. Keep in mind that these change with regard to orientation and device, so you'll have to have some logic to determine what that rectangle should be in each.

Hope that helps?

Tom Krones

unread,
Mar 8, 2012, 2:04:49 AM3/8/12
to phon...@googlegroups.com
This is great!  Thanks for the response.  I'm going to get started testing.  My app only uses portrait mode so that makes the logic easier.  Is it possible to just as an if statement that checks if it's running on an iPad vs iPhone and and just use one of two coordinate values?

Thanks again for the help!!

Tom Krones

unread,
Mar 8, 2012, 2:20:41 AM3/8/12
to phon...@googlegroups.com
Also, would it be possible to use the camera.h/.m files as a plugin so that I don't have to compile phonegap?

Tom

Kerri Shotts

unread,
Mar 8, 2012, 2:34:26 AM3/8/12
to phon...@googlegroups.com
Possible, yes. You'd essentially take the camera.m and .h files and rename them to something like MyCustomCamera.m /.h, and then extract the relevant portions from the phonegap.js file that relate to the camera and rename them as well. I'm sure I'm over simplifying, but it shouldn't be too hard to do.

Kerri Shotts

unread,
Mar 8, 2012, 2:39:04 AM3/8/12
to phon...@googlegroups.com
Pretty sure there's a way, but I can't remember offhand. Found this on stack overflow, might be of help: http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk

Tom Krones

unread,
Mar 8, 2012, 2:49:35 AM3/8/12
to phon...@googlegroups.com
Sweet!  That's easy.  I'll make that plan B.  Right now I'm trying the plugin route.  I would rather not recompile phonegap.

Tom Krones

unread,
Mar 8, 2012, 3:17:56 AM3/8/12
to phon...@googlegroups.com
New speed bump.  Looks like I need a new version of osx:

Error: You need to package the installer on a Mac OS X 10.7 Lion system.
make: *** [checkos] Error 1

I've attached my changed camera.m file to this post, it accepts a parameter for the windowWidth and windowHeight which allows users to change the window size.

I tried the plugin route but got so many errors that I gave up.

Anyone want to compile that for me?

Tom
Camera.m

Shazron

unread,
Mar 11, 2012, 7:16:58 PM3/11/12
to phon...@googlegroups.com
Hmm that check was removed in the installer target of the Makefile.
Shouldn't be in any release.
On this line of your Makefile:
https://github.com/apache/incubator-cordova-ios/blob/1.4.0/Makefile#L154
Remove the "checkos" token.

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to

> phonegap+u...@googlegroups.com

Tom Krones

unread,
Mar 11, 2012, 11:33:04 PM3/11/12
to phon...@googlegroups.com
Thanks, I'll check that.  I must have downloaded the wrong version of the code...  Where do I get the code now?

Tom
>>> icon/button used to generate the popover -- then th> --

Shazron

unread,
Mar 12, 2012, 1:49:43 PM3/12/12
to phon...@googlegroups.com

WootWoot1234

unread,
Mar 15, 2012, 8:52:35 AM3/15/12
to phon...@googlegroups.com
I think I'm over my head.  I made these edits to the latest code (thanks for the link Shazron) but still no luck.  When I call the popover nothing happens now.  Here are my changes can anyone see what I'm doing wrong?

Made these changes to line 100 of CDVCamera.m

            self.pickerController.popoverController.delegate = self;

            NSNumber* windowWidth = [options valueForKey:@"windowWidth"];

            NSNumber* windowHeight = [options valueForKey:@"windowHeight"];

            NSNumber* windowX = [options valueForKey:@"windowX"];

            NSNumber* windowY = [options valueForKey:@"windowY"];

            CGRect windowSize = CGRectMake(0,32,320,480);

            if (windowWidth != nil && windowHeight != nil) {

                if (windowX != nil && windowY != nil) {

                    windowSize = CGRectMake([windowX intValue],[windowY intValue],[windowWidth intValue], [windowHeight intValue]);

                } else {

                    windowSize = CGRectMake(0,32,[windowWidth intValue], [windowHeight intValue]);

                }

            }

            [ self.pickerController.popoverController presentPopoverFromRect:windowSize

                                                                      inView:[self.webView superview]

                                                    permittedArrowDirections:UIPopoverArrowDirectionAny 

                                                                    animated:YES]; 


and then call it in the js file like this:

window.plugins.CameraPlugin.getPicture(onPhotoDataSuccess, onFail, { 

                                               quality: 50

                                               destinationType: destinationType.FILE_URI,

                                               sourceType: pictureSource.PHOTOLIBRARY,

                                               encodingType: Camera.EncodingType.JPG

                                               });


Thanks in advance,

Tom


>> > For more options, visit this group at
>> > http://groups.google.com/group/phonegap?hl=en?hl=en
>> >
>> > For more info on PhoneGap or to download the code go to www.phonegap.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "phonegap" group.
>> To post to this group, send email to phon...@googlegroups.com
>> To unsubscribe from this group, send email to


>> For more options, visit this group at
>> http://groups.google.com/group/phonegap?hl=en?hl=en
>>
>> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to

Giacomo Balli

unread,
Mar 15, 2012, 9:48:14 AM3/15/12
to phonegap
there must be some conflict somewhere.
I would place a few NSLogs here and there to know what is going on.

Specifically:
1) with all the arguments passed
2) the windowSize that is generated by the if statement and one final
before the end of the method to make sure everything stays the same
and nothing gets in the way.
> > On Sun, Mar 11, 2012 at 8:33 PM, Tom Krones <tkro...@gmail.com> wrote:
> > > Thanks, I'll check that.  I must have downloaded the wrong version of the
> > > code...  Where do I get the code now?
>
> > > Tom
>
> > > On Monday, March 12, 2012, Shazron wrote:
>
> > >> Hmm that check was removed in the installer target of the Makefile.
> > >> Shouldn't be in any release.
> > >> On this line of your Makefile:
>
> >https://github.com/apache/incubator-cordova-ios/blob/1.4.0/Makefile#L154
> > >> Remove the "checkos" token.
>
> > >> On Thu, Mar 8, 2012 at 12:17 AM, Tom Krones <tkro...@gmail.com> wrote:
> > >> > New speed bump.  Looks like I need a new version of osx:
>
> > >> > Error: You need to package the installer on a Mac OS X 10.7 Lion
> > system.
> > >> > make: *** [checkos] Error 1
>
> > >> > I've attached my changed camera.m file to this post, it accepts a
> > >> > parameter
> > >> > for the windowWidth and windowHeight which allows users to change the
> > >> > window
> > >> > size.
>
> > >> > I tried the plugin route but got so many errors that I gave up.
>
> > >> > Anyone want to compile that for me?
>
> > >> > Tom
>
> > >> > On Thu, Mar 8, 2012 at 5:49 PM, Tom Krones <tkro...@gmail.com> wrote:
>
> > >> >> Sweet!  That's easy.  I'll make that plan B.  Right now I'm trying
> > the
> > >> >> plugin route.  I would rather not recompile phonegap.
>
> > >> >> On Thursday, March 8, 2012, Kerri Shotts wrote:
>
> > >> >>> Pretty sure there's a way, but I can't remember offhand. Found this
> > on
> > >> >>> stack overflow, might be of
>
> > >> >>> help:
> >http://stackoverflow.com/questions/448162/determine-device-iphone-ipo...
> > >> > phonegap+u...@googlegroups.com
> > >> > For more options, visit this group at
> > >> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > >> > For more info on PhoneGap or to download the code go to
> >www.phonegap.com
>
> > >> --
> > >> You received this message because you are subscribed to the Google
> > >> Groups "phonegap" group.
> > >> To post to this group, send email to phon...@googlegroups.com
> > >> To unsubscribe from this group, send email to
> > >> phonegap+u...@googlegroups.com
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > >> For more info on PhoneGap or to download the code go to
> >www.phonegap.com
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "phonegap" group.
> > > To post to this group, send email to phon...@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > phonegap+u...@googlegroups.com

Michael Enz

unread,
May 10, 2012, 10:48:13 AM5/10/12
to phon...@googlegroups.com
Any progress on this?
Since Apple rejects apps because of this bug, I'm now also trying to fix this.
I didn't get very far though, since I'm not familiar with objective C.

Any news would be appreciated.

Tom Krones

unread,
May 10, 2012, 6:22:19 PM5/10/12
to phon...@googlegroups.com
I just gave up, removed the feature... :(

jcesar

unread,
May 11, 2012, 2:03:09 PM5/11/12
to phonegap
Maybe who programed this can change the popover to a modal view
controller

Devgeeks

unread,
May 11, 2012, 10:42:40 PM5/11/12
to phon...@googlegroups.com
It tests for the availability of popovers and if so uses them... otherwise it uses a modal.

In other words, popovers on iPad, modal on iPhone/iPod.

Tom Krones

unread,
May 12, 2012, 12:06:51 AM5/12/12
to phon...@googlegroups.com
It would be great if a parameters were added for location and arrow direction.

Devgeeks

unread,
May 12, 2012, 8:06:23 PM5/12/12
to phon...@googlegroups.com
http://issues.cordova.io/

Raise an issue... It's probably needed...

jcesar

unread,
May 14, 2012, 2:24:24 AM5/14/12
to phonegap
Devgeeks, but you can use modal view controllers with iPad too, so, if
the popover don't show the arrow correctly, using a modal view
controller won't have this problem because it doesn't have arrows.

Devgeeks

unread,
May 14, 2012, 2:49:40 AM5/14/12
to phon...@googlegroups.com
Yeah. Something needs to change... just not sure what the best solution is.

In the short term maybe I'll see if I have tim this week to whip up a plugin version of the Camera API that always uses a modal popover support or no.

Michael Enz

unread,
May 31, 2012, 8:31:34 AM5/31/12
to phon...@googlegroups.com
I "fixed" this by forcing the use of a modal even if popovers are supported by the device.

In Camera.m:getPicture I just changed
if([self popoverSupported] && sourceType != UIImagePickerControllerSourceTypeCamera)
to
if(/*FIX*/NO && /*END FIX*/[self popoverSupported] && sourceType != UIImagePickerControllerSourceTypeCamera)
and recompiled PG.

Cheers

Devgeeks

unread,
May 31, 2012, 8:25:00 PM5/31/12
to phon...@googlegroups.com
Hehe.. Let us know if Apple is happy with this.

Becka11y

unread,
Jun 1, 2012, 3:29:44 PM6/1/12
to phon...@googlegroups.com
This has been fixed for the 1.8 release.  There is now the option to specify the location where to anchor the popup and to specify the arrow direction.   I haven't had a chance to write up instructions,  yet.  Probably won't get into 1.8 documentation but I'll write a post once 1.8 is released.  See https://issues.apache.org/jira/browse/cb-56

-becky

Devgeeks

unread,
Jun 1, 2012, 7:12:49 PM6/1/12
to phon...@googlegroups.com
As always, you are a champion, Becky.
Reply all
Reply to author
Forward
0 new messages