incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Goldspink (JIRA)" <>
Subject [jira] [Created] (CB-818) Make CDVViewController also implement initWithNibName
Date Mon, 21 May 2012 17:28:40 GMT
Matt Goldspink created CB-818:

             Summary: Make CDVViewController also implement initWithNibName
                 Key: CB-818
             Project: Apache Cordova
          Issue Type: Improvement
          Components: iOS
    Affects Versions: 1.7.0
            Reporter: Matt Goldspink
            Assignee: Shazron Abdullah
            Priority: Minor

I just got caught upgrading from 1.5.0 to 1.7.0 by this. I extend CDVViewController, but I
also use a nib file. The behaviour I was seeing was that the app would crash shortly after
startup. When I used Zombie's in Instruments I could see that the CDVLocalStorage class was
being allocated and then de-allocated straight away and the EXC_BAD_ACCESS error would be
thrown by something trying to access it later on.

After a long time debugging I realised that the init method was not being called on the CDVViewController
because I was being initialised from a nib and hence:

-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

was being called. Because init was not being called the commandDelegate was not set and hence
the line which allocated the CDVViewController to registerPlugins would be doing it on a nil
object. If initWithNibName was implemented and just invoked init() this would solve this issue
and hopefully not let others extending CDVViewController get caught out either

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message