最近在做阿里百川的Cordova插件,将其iOS SDK的.framework写入plugin.xml之后,在工程中添加插件报错如下:
Failed to install 'com.qiqujie.taobaoplugin':TypeError: Cannot read property 'nodeName' of null
at Object.parse (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/plist/lib/parse.js:45:26)
at Object.module.exports.package_name (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/ios.js:143:22)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/PlatformApiPoly.js:267:67
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:857:14
at runSingle (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-common/node_modules/q/q.js:125:13)
at doNTCallback0 (node.js:430:9)
Error: Cannot read property 'nodeName' of null
plugin.xml的iOS部分:
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="Wechat">
<param name="ios-package" value="CDVWechat" />
<param name="onload" value="true" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<dict>
<key>CFBundleURLName</key>
<string>com.taobao.taesdk</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tbopen********</string>
</array>
</dict>
</config-file>
<!-- Plugin source code -->
<header-file src="src/ios/CDVTaobao.h" />
<source-file src="src/ios/CDVTaobao.m" />
<!-- Baichuan frameworks -->
<framework src="src/ios/libs/ALBBFullSecurityGuard.framework" custom="true" />
<framework src="src/ios/libs/ALBBLoginSDK.framework" custom="true" />
<framework src="src/ios/libs/ALBBRpcPlugin.framework" custom="true" />
<framework src="src/ios/libs/ALBBTBOpenPlugin.framework" custom="true" />
<framework src="src/ios/libs/ALBBTradeSDK.framework" custom="true" />
<framework src="src/ios/libs/AlipaySDK.framework" custom="true" />
<framework src="src/ios/libs/SecurityGuardSDK.framework" custom="true" />
<framework src="src/ios/libs/TAESDK.framework" custom="true" />
<framework src="src/ios/libs/TBAppLinkSDK.framework" custom="true" />
<framework src="src/ios/libs/UTDID.framework" custom="true" />
<framework src="src/ios/libs/UTMini.framework" custom="true" />
<!-- Baichuan Resources -->
<resource-file src="src/ios/libs/AlipaySDK.bundle" />
<resource-file src="src/ios/libs/Tae.bundle" />
<resource-file src="src/ios/libs/yw_1222.jpg" />
<!-- Fundamental frameworks -->
<framework src="libstdc++.6.0.9.dylib" />
<framework src="libz.dylib" />
<framework src="MobileCoreServices.framework" />
<framework src="AssetsLibrary.framework" />
<framework src="ImageIO.framework" />
<framework src="CoreData.framework" />
<framework src="CoreLocation.framework" />
<framework src="Security.framework" />
<framework src="SystemConfiguration.framework" />
<framework src="CoreTelephony.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreGraphics.framework" />
<framework src="UIKit.framework" />
<framework src="Foundation.framework" />
</platform>
我尝试逐个framework文件添加时,只有部分framework文件会造成这个问题,例如ALBBLoginSDK.framework
,而ALBBFullSecurityGuard.framework
和TAESDK.framework
则不会
Google找到一个cordova的issue,说there was some corruption of the Info.plist which results in this crash,但是我用xcode可以顺利读出framework中的信息,有什么办法可以解决这个问题吗?先谢了:)
포스터에 언급된 Cordova는 예전 PhoneGap이겠죠?
은
ALBBLoginSDK.framework
과ALBBTradeSDK.framework
에Info.plist
과项目名-Info.plist
이 모두 포함되어 있고 내용이 일치하지 않는 것 같습니다. 반면 다른 프레임워크 파일에는Info.plist
만 있고 문제가 있는 두 프레임워크에는项目名-Info.plist
만 있습니다. 삭제 후 성공적으로 가져오실 수 있습니다. 타오바오 앱 호출 기능은 아직까지 문제가 발견되지 않았습니다...글쎄요, Dandelion용 cordvoa 플러그인을 작성할 때 비슷한 현상을 겪었습니다. 오랫동안 디버깅을 하다가 특정 plist 파일을 구문 분석하는 데 오류가 있는 것을 발견했습니다. Dandelion SDK의 info.plist가 왜곡된 것으로 나타났습니다. . . 구문 분석이 실패하게 됩니다.
두 프레임워크의 plist 파일 내용에 문제가 있는 것으로 추정됩니다.