You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2013/02/14 19:15:13 UTC
[jira] [Created] (CB-2438) Add an explicit initialize method to
CDVPlugin.m
Andrew Grieve created CB-2438:
---------------------------------
Summary: Add an explicit initialize method to CDVPlugin.m
Key: CB-2438
URL: https://issues.apache.org/jira/browse/CB-2438
Project: Apache Cordova
Issue Type: Bug
Components: iOS
Reporter: Andrew Grieve
Assignee: Andrew Grieve
Priority: Minor
Fix For: 2.5.0
Right now we have:
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings
{
self = [self initWithWebView:theWebView];
if (self) {
self.settings = classSettings;
self.hasPendingOperation = NO;
}
return self;
}
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView
{
self = [super init];
...
So... Looks like initWithWebView: is the designated initializer, but the plugin doesn't get it's settings set until after it returns. Also, self.viewController and self.commandDelegate get set after the initializer altogether.
In Android, we use two-step initialization:
this.plugin = (CordovaPlugin) c.newInstance();
this.plugin.initialize(ctx, webView);
We can't remove either initializer without breaking compatibility, but maybe we could deprecate them?
I think it also makes sense to use two-phase initialization on iOS. Perhaps "pluginDidInitialize".
ML Thread: http://callback.markmail.org/thread/atl6gs7dnz5k34rq
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira