I'm in the process of porting an iOS app I built using Phonegap to iOS7 with Phonegap 3.1 and I've run into a little issue.
iOS 7 seems to have made some significant changes in that hyperlinks with the target="_blank" attribute
are now opened by default within the app itself, rather than in the system browser (this doesn't seem to happen on Android, or previous versions of iOS, however). This has broken some of the functionality of the app, and I need to correct this.
Using the InAppBrowser plugin seems like the way to go, so I've installed the plugin. I've amended my config.xml to include this:
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
And the link in the template now looks like this (please note I'm using Handlebars as the templating system here):
<a href="#" onclick="window.externalbrowser = window.open('{{this.url}}, ', '_system', 'location=yes');" data-transition="slide">
<img alt="Favicon" style="border: 1px solid #ccc;" title="Favicon" class="ui-li-icon" src="{{this.favicon_url}}"></img>
<p style="font-size: 100%"><strong>Submitted {{this.whenSubmitted}}</strong><br />Last changed {{this.lastChanged}}</p>
</a>
Whenever I click the link, it fails to open and I get the following error appear in the logs:
Plugin 'InAppBrowser' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-11-08 10:22:56.753 MyApp[197:60b] -[CDVCommandQueue executePending] [Line 117] FAILED pluginJSON = [
"InAppBrowser814285423",
"InAppBrowser",
"open",
[
"http:\/\/www.site.co.uk\/deals-offers-savings\/b?ie=UTF8&node=350613011&tag=page0e-21,",
"_system",
"location=yes"
]
]
There are also a number of deprecation warnings about the CDVInAppBrowser.m
source file.
I can't for the life of me see why the plugin is not being picked up. Can anyone else suggest what the issue might be?
I found a true solution for this without having to recreate the project. based on this answer: similar question and answer
It appears that this happens because sometimes the xcode project files aren't update after adding/removing plugins. All the files are in place, and the config.xml is in order but the xcode project fails to mark the new plugin files as targetting the application.
Solution: