[
https://issues.apache.org/jira/browse/CB-1970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13511146#comment-13511146
]
Shazron Abdullah commented on CB-1970:
--------------------------------------
This is a new change in 2.2.0 that wasn't reflected in the MainViewController
commented-out code. registerPlugin, execute and getCommandInstance just
happened to work because the CDVViewController.commandDelegate redirects to
it's registered viewcontroller's functions of the same name (and this is not
guaranteed to work the same way, always use the CDVCommandDelegateImpl)
To override, you need to create your own CDVCommandDelegateImpl sub-class, and
override pathForResource. Then register it to the .commandDelegate property of
MainViewController.
// in MainViewController.m
self.commandDelegate = [[MyCDVCommandDelegateImpl alloc]
initWithViewController:self];
I realize the property is read-only -- I'll take a look at this issue further
when I can do some tests tomorrow at work.
See CB-1972 for the issue tracking the outdated commented out code.
> MainViewController cannot override pathForResource
> --------------------------------------------------
>
> Key: CB-1970
> URL: https://issues.apache.org/jira/browse/CB-1970
> Project: Apache Cordova
> Issue Type: Bug
> Components: iOS
> Affects Versions: 2.2.0
> Environment: iOS 5.1, iOS Simulator 4.3, 5.0, 5.1 & 6.0
> Reporter: Michael Richey
> Assignee: Shazron Abdullah
>
> Attempting to override CDVCommandDelegateImpl.m pathForResource method within
> MainViewController.m using the provided override methods, all overrides work
> except for pathForResource.
> My simple test was to uncomment all of the overrides and add an NSLog to each
> before the existing code. Each of: getCommandInstance, execute, and
> registerPlugin work as expected - but pathForResource executes the original
> method from CDVCommandDelegateImpl.m
--
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