ChildBrowser supportedOrientations

1,960 views
Skip to first unread message

IC

unread,
Sep 16, 2012, 11:38:02 PM9/16/12
to phon...@googlegroups.com
I am using Cordova 2.1.0rc2 with childBrowser plugin.

I have copied newer version of cordova AppDelegate and MainViewController classes to my project and have this error:
property 'supportedOrientations' is not found on object of type CDVViewController.

If I comment out the line, the childBrowser does not rotate.

Can you please outline the steps I need to take to rectify this problem, including the correct childBrowser plugin location that can be used with 2.1.0rc2.

Thanks

IC

unread,
Sep 16, 2012, 11:41:57 PM9/16/12
to phon...@googlegroups.com
This is for IOS 5.1.1.
xCode 4.4

IC

unread,
Sep 18, 2012, 12:32:34 PM9/18/12
to phon...@googlegroups.com
Can someone please help!  In xcode, I have to comment out the supportedOrientations line as the property 'supportOrientations' not found on object of type 'CDVViewController'.



On Monday, 17 September 2012 13:38:02 UTC+10, IC wrote:

Mike

unread,
Sep 19, 2012, 4:43:15 AM9/19/12
to phon...@googlegroups.com
I've been crawling Google for weeks trying to figure this out. Apparently there is something you have to do to the ChildBrowserViewController.m file and allow it to accept multiple orientations. 

Please some one with any experience help us out

Shazron

unread,
Sep 19, 2012, 2:45:19 PM9/19/12
to phon...@googlegroups.com
The supportedOrientations property was made private - which means you
have to use the other new functions to read the orientation. I'll fix
the plugin today.
> --
> -- 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
>
> To compile in the cloud, check out build.phonegap.com
>
>

IC

unread,
Sep 19, 2012, 11:16:54 PM9/19/12
to phon...@googlegroups.com

It compiles but won't run. 


#import <UIKit/UIKit.h>



int main(int argc, char *argv[]) {

    
    @autoreleasepool {
        
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); #### ERROR HERE - Thread 1:signal SIGABRT ######

        return retVal;

    }
}

Sep 20 13:09:41 unknown agroplan[1133] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray count]: method sent to an uninitialized mutable array object'
*** First throw call stack:
(0x356bb88f 0x37a62259 0x356ae431 0x356b1db1 0x914b5 0xe109d 0xe0a7b 0x3561a1fb 0x351de747 0x3568fad3 0x3568f29f 0x3568e045 0x356114a5 0x3561136d 0x372ad439 0x3311dcd5 0x9054f 0x90510)
 >  > 




On Thursday, 20 September 2012 05:10:58 UTC+10, Jake Williams wrote:

NSMutableArray* supportedOrientations = [NSMutableArray alloc];

    if ([cont supportsOrientation:UIInterfaceOrientationPortrait]) {

        [supportedOrientations addObject: [NSNumber numberWithInt:UIDeviceOrientationPortrait]];

    }

    if ([cont supportsOrientation:UIDeviceOrientationPortraitUpsideDown]) {

        [supportedOrientations addObject: [NSNumber numberWithInt:UIDeviceOrientationPortraitUpsideDown]];

    }

    if ([cont supportsOrientation:UIDeviceOrientationLandscapeLeft]) {

        [supportedOrientations addObject: [NSNumber numberWithInt:UIDeviceOrientationLandscapeLeft]];

    }

    if ([cont supportsOrientation:UIDeviceOrientationLandscapeRight]) {

        [supportedOrientations addObject: [NSNumber numberWithInt:UIDeviceOrientationLandscapeRight]];

    }

    childBrowser.supportedOrientations = supportedOrientations;

Haven't been able to test yet because I incorrectly installed cordova 2.1 or something, but this got rid of the error (and let me see that I messed up elsewhere).

IC

unread,
Sep 19, 2012, 11:30:13 PM9/19/12
to phon...@googlegroups.com
It works it I change this line:
NSMutableArray* supportedOrientations = [NSMutableArray alloc];
to 
NSMutableArray* supportedOrientations =[[NSMutableArray alloc] init];

Thanks Jake

Kerri Shotts

unread,
Sep 19, 2012, 11:35:06 PM9/19/12
to phon...@googlegroups.com
Try adding [NSMutableArray init]; after the alloc. Does that make a difference?

______________________________
Kerri Shotts
photoKandy Studios LLC

Sent from my iPhone

📱 Phone: +1 (312) 380-1035
🌐 Web: http://photokandy.com

Twitter: @photokandy

On Sep 19, 2012, at 22:17, IC <pet...@internetcreative.com.au> wrote:

> [NSMutableArray alloc];

IC

unread,
Sep 20, 2012, 1:06:23 AM9/20/12
to phon...@googlegroups.com
The childBrowser is working, but when the childBrowser closes it messes up the PhoneGap app by displaying portrait in a landscape view.


On Monday, 17 September 2012 13:38:02 UTC+10, IC wrote:

Shazron

unread,
Sep 20, 2012, 2:20:51 AM9/20/12
to phon...@googlegroups.com
This is good, but the ChildBrowserViewController really needs to
determine this dynamically through its shouldRotate delegate. If you
look at the CDVViewController code, it in turn determines this
dynamically as well (by checking a javascript function).

On Wed, Sep 19, 2012 at 12:10 PM, Jake Williams <willia...@gmail.com> wrote:
> NSMutableArray* supportedOrientations = [NSMutableArray alloc];
>
> if ([cont supportsOrientation:UIInterfaceOrientationPortrait]) {
>
> [supportedOrientations addObject: [NSNumber
> numberWithInt:UIDeviceOrientationPortrait]];
>
> }
>
> if ([cont supportsOrientation:UIDeviceOrientationPortraitUpsideDown]) {
>
> [supportedOrientations addObject: [NSNumber
> numberWithInt:UIDeviceOrientationPortraitUpsideDown]];
>
> }
>
> if ([cont supportsOrientation:UIDeviceOrientationLandscapeLeft]) {
>
> [supportedOrientations addObject: [NSNumber
> numberWithInt:UIDeviceOrientationLandscapeLeft]];
>
> }
>
> if ([cont supportsOrientation:UIDeviceOrientationLandscapeRight]) {
>
> [supportedOrientations addObject: [NSNumber
> numberWithInt:UIDeviceOrientationLandscapeRight]];
>
> }
>
> childBrowser.supportedOrientations = supportedOrientations;
>
> Haven't been able to test yet because I incorrectly installed cordova 2.1 or
> something, but this got rid of the error (and let me see that I messed up
> elsewhere).
>
>
> On Sunday, September 16, 2012 10:38:02 PM UTC-5, IC wrote:
>>

Shazron

unread,
Sep 20, 2012, 2:24:08 AM9/20/12
to phon...@googlegroups.com
That bug has been fixed in https://issues.apache.org/jira/browse/CB-1465

Shazron

unread,
Sep 20, 2012, 10:46:09 PM9/20/12
to phon...@googlegroups.com
ChildBrowser has been updated in the repo.

IC

unread,
Sep 21, 2012, 12:10:08 AM9/21/12
to phon...@googlegroups.com
Thanks for you great effort but this is what is happening when I run the application

<Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x361042a3 0x3441497f 0x3604e8d9 0x90e1d 0xc5293 0x78193 0x373f4595 0x37434d79 0x37430aed 0x374721d1 0x77b4b 0x37435ad9 0x37435663 0x3742d84b 0x373d5c41 0x373d56d5 0x373d5123 0x365885a3 0x365881d3 0x360d9173 0x360d9117 0x360d7f99 0x3604aebd 0x3604ad49 0x3742c485 0x37429301 0x7740f 0x773d0)

Shazron Abdullah

unread,
Sep 21, 2012, 1:05:33 AM9/21/12
to phon...@googlegroups.com
It works on a new project - what's your setup, provide a test project that can replicate your error.

IC

unread,
Sep 21, 2012, 1:26:02 AM9/21/12
to phon...@googlegroups.com
I am using Xcode 4.5 and IOS6.
Is that what you tested?

Shazron

unread,
Sep 21, 2012, 3:11:29 AM9/21/12
to phon...@googlegroups.com
Yes. Without a test project that replicates this I can't help you. Put
it up somewhere.

Jonathan Brumley

unread,
Oct 11, 2012, 3:24:42 AM10/11/12
to phon...@googlegroups.com
Hey IC and Shazron, I was having the same issue and I manage to fix it by adding this line of code in ChidBrowserViewController.m

@synthesize scaleEnabled;

so now instead of 

@implementation ChildBrowserViewController

@synthesize imageURL, isImage;

@synthesize delegate, orientationDelegate;

@synthesize spinner, webView, addressLabel;

@synthesize closeBtn, refreshBtn, backBtn, fwdBtn, safariBtn;

I have this

@implementation ChildBrowserViewController

@synthesize scaleEnabled;

@synthesize imageURL, isImage;

@synthesize delegate, orientationDelegate;

@synthesize spinner, webView, addressLabel;

@synthesize closeBtn, refreshBtn, backBtn, fwdBtn, safariBtn;

Hope this help anyone else having the same issue and also that this get updated in github. 

Best,
JB
Reply all
Reply to author
Forward
0 new messages