外部ブラウザで特定のリンクを開く PhoneGap アプリの機能をセットアップしようとしています。コードは Android で正常に動作するように見えます (プラグイン情報ではまだサポートがないと主張しているため、Windows Phone ではテストしませんでした...)、これを iPhone で実行しようとするたびにシミュレーター (iOS 5.1) では、次のエラーで爆発します。
testCB[3332:c07] CDVPlugin class childbrowser.js (pluginName: ChildBrowser) does not exist.
testCB[3332:c07] ERROR: Plugin 'ChildBrowser' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist.
testCB[3332:c07] -[CDVCommandQueue executePending] [Line 102] FAILED pluginJSON = ["ChildBrowser1249404349","ChildBrowser","showWebPage",["http://www.apple.com",{"showLocationBar":true}]]
私はフォーラム全体とここを調べましたが、人々が Cordova.plist ファイルの更新について言及しているのを見続けています。よし、ここにある (これはアップグレードや更新ではなく、新しい Cordova アプリ用であることに注意してください。現在、自分のアプリの不安定さを排除するために、テスト アプリでこれを試しています):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- the standard keys snipped -->
<key>ExternalHosts</key>
<array>
<string>*</string>
</array>
<key>Plugins</key>
<dict>
<key>ChildBrowser</key>
<string>childbrowser.js</string>
<key>ChildBrowserCommand</key>
<string>ChildBrowserCommand</string>
<key>Device</key>
<string>CDVDevice</string>
<key>Logger</key>
<string>CDVLogger</string>
<key>Compass</key>
<string>CDVLocation</string>
<key>Accelerometer</key>
<string>CDVAccelerometer</string>
<key>Camera</key>
<string>CDVCamera</string>
<key>NetworkStatus</key>
<string>CDVConnection</string>
<key>Contacts</key>
<string>CDVContacts</string>
<key>Debug Console</key>
<string>CDVDebugConsole</string>
<key>Echo</key>
<string>CDVEcho</string>
<key>File</key>
<string>CDVFile</string>
<key>FileTransfer</key>
<string>CDVFileTransfer</string>
<key>Geolocation</key>
<string>CDVLocation</string>
<key>Notification</key>
<string>CDVNotification</string>
<key>Media</key>
<string>CDVSound</string>
<key>Capture</key>
<string>CDVCapture</string>
<key>SplashScreen</key>
<string>CDVSplashScreen</string>
<key>Battery</key>
<string>CDVBattery</string>
<key>Globalization</key>
<string>CDVGlobalization</string>
</dict>
</dict>
</plist>
(編集) 私の index.html ファイルに、以下を含めました (これはほとんど言うまでもありません。また、明白なことをすべて最初に試すことを考えていない人々によって多くの質問が投稿されることも理解しています!):
<script type="text/javascript" src="cordova-2.2.0.js"></script>
<script type="text/javascript" src="childbrowser.js"></script>
私のjs呼び出しは次のようになります:
onDeviceReady: function() {
app.receivedEvent('deviceready');
var link = document.getElementById('launchApple');
console.log('derp?');
if(link){
//var cb = ChildBrowser.install();
console.log("We're trying to add a click handler link");
link.addEventListener('click', function() {
console.log('click');
window.plugins.childBrowser.openExternal('http://www.apple.com'); });
}
},
リンクをクリックすると、上記のエラーが発生します。
childbrowser.js ファイルの大文字と小文字を ChildBrowser.js に変更してみました。iPhone 6エミュレーターで実行してみました。私の Plugins フォルダーには、 https://github.com/alunny/ChildBrowserからダウンロードしたパッケージのすべてのファイルが含まれています。
~/Library/Application Support からキャッシュをクリアしました プロジェクトで Clean を試しました。
何かご意見は?私は、「一度書けばどこでも走れる」神々 (トリックスターのロキの子孫であると確信しています) への素早い生贄として、良いヤギかニワトリを探し始めようとしています!