我主要是使用 Cordova 的混合应用程序开发人员。我遇到了一个有趣的场景,我认为我需要创建一个 Cordova 插件来实现此处提供的适用于 iOS 和 Android 的本机 Garmin SDK 。
我已经查看了 cordova 的插件文档并完成了他们的示例。链接在这里。我还查看了有关此事的一些不错的资源,请参阅Instabug和Modus中的一个。
但是,我缺乏足够的知识来理解为什么 Garmin SDK 中缺少其他教程中包含的某些组件。主要是 ConnectIQ.bundle。
我也不确定是什么导致了我遇到的错误。我有一种感觉,该项目无法通过我正在尝试开发的自定义插件找到实现 ConnectIQ.framework 的特定文件。
我什至找到了另一个人实现他们去年发布的非官方 cordova Connect IQ 插件。执行后,这是我的错误日志:
2016-12-18 18:35:04.748 appTest[56419:4257397] CDVPlugin class CIQPlugin (pluginName: connectiq) does not exist.
2016-12-18 18:35:04.748 appTest[56419:4257397] [CDVTimer][connectiq] 0.180006ms
2016-12-18 18:35:13.942 appTest[56419:4257397] CDVPlugin class CIQPlugin (pluginName: ConnectIQ) does not exist.
2016-12-18 18:35:13.942 appTest[56419:4257397] ERROR: Plugin 'ConnectIQ' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2016-12-18 18:35:13.942 app Test[56419:4257397] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["INVALID","ConnectIQ","initializeWithUrlScheme",["prefs-123456"]]
这包含 plugin.xml 文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2014 PayPal. All rights reserved. -->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.heavydutydev.cordova.ciq"
version="0.0.1">
<name>Cordova CIQ</name>
<description>This plugin allows basic interactions with the Garmin Connect IQ native interfaces</description>
<keywords>garmin, connect-iq, connect iq</keywords>
<license>NONE</license>
<engines>
<engine name="cordova" version=">=5.0.0" />
</engines>
<!-- ios -->
<platform name="ios">
<js-module src="www/cdv-plugin-connect-iq.js" name="ConnectIQ">
<clobbers target="ConnectIQ" />
</js-module>
<config-file target="config.xml" parent="/*">
<feature name="ConnectIQ">
<param name="ios-package" value="CIQPlugin" onload="true" />
</feature>
</config-file>
<source-file src="src/ios/ConnectIQ.framework" framework="true" />
<!-- <header-file src="src/ios/PayPalMobileCordovaPlugin.h" />
<source-file src="src/ios/PayPalMobileCordovaPlugin.m" />
<header-file src="src/ios/PayPalMobile/PayPalConfiguration.h" />
<header-file src="src/ios/PayPalMobile/PayPalFuturePaymentViewController.h" />
<header-file src="src/ios/PayPalMobile/PayPalMobile.h" />
<header-file src="src/ios/PayPalMobile/PayPalOAuthScopes.h" />
<header-file src="src/ios/PayPalMobile/PayPalPayment.h" />
<header-file src="src/ios/PayPalMobile/PayPalPaymentViewController.h" />
<header-file src="src/ios/PayPalMobile/PayPalProfileSharingViewController.h" />
<source-file src="src/ios/PayPalMobile/libPayPalMobile.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libCardIO.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libopencv_core.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libopencv_imgproc.a" framework="true" />
<framework src="Accelerate.framework" />
<framework src="AudioToolbox.framework" />
<framework src="AVFoundation.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreGraphics.framework" />
<framework src="CoreLocation.framework" weak="true" />
<framework src="CoreMedia.framework" weak="true" />
<framework src="CoreVideo.framework"/>
<framework src="MessageUI.framework" />
<framework src="OpenGLES.framework" />
<framework src="MobileCoreServices.framework" />
<framework src="Security.framework" />
<framework src="SafariServices.framework"/>
<framework src="SystemConfiguration.framework" />
<framework src="QuartzCore.framework"/>
<framework src="UIKit.framework"/>
<framework src="libc++.dylib" />
<framework src="libPayPalMobile.a" />
<framework src="libCardIO.a" />
<framework src="libopencv_core.a" />
<framework src="libopencv_imgproc.a" /> -->
</platform>
<platform name="android">
<js-module src="www/cdv-plugin-connect-iq.js" name="ConnectIQ">
<clobbers target="ConnectIQ" />
</js-module>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="ConnectIQ">
<param name="android-package" value="com.heavydutydev.cordova.ciq.CIQPlugin" />
</feature>
</config-file>
<source-file src="src/android/com/heavydutydev/cordova/ciq/CIQPlugin.java" target-dir="src/com/heavydutydev/cordova/ciq" />
<source-file src="src/android/com/heavydutydev/cordova/ciq/CIQContext.java" target-dir="src/com/heavydutydev/cordova/ciq" />
<source-file src="src/android/libs/connectiq.jar" target-dir="libs" />
<!--
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
</config-file> -->
<!-- <config-file target="AndroidManifest.xml" parent="/manifest/application">
<service android:name="com.paypal.android.sdk.payments.PayPalService"
android:exported="false" />
<activity android:name="com.paypal.android.sdk.payments.PaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.LoginActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" />
<activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity" />
<activity android:name="com.paypal.android.sdk.payments.PayPalProfileSharingActivity" />
<activity android:name="com.paypal.android.sdk.payments.ProfileSharingConsentActivity" />
<activity
android:name="io.card.payment.CardIOActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" />
</config-file> -->
</platform>
</plugin>
基于这些错误和我的研究,我认为 plugin.xml 和 config.xml 与我尝试实现的 SDK 没有正确对齐。如果有人可以提供一些额外的故障排除步骤,以便我可以了解有关该问题的更多信息,将不胜感激。