recherche

Maison  >  Questions et réponses  >  le corps du texte

objective-c - Cordova插件开发时无法导入阿里百川的iOS SDK

最近在做阿里百川的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.frameworkTAESDK.framework则不会
Google找到一个cordova的issue,说there was some corruption of the Info.plist which results in this crash,但是我用xcode可以顺利读出framework中的信息,有什么办法可以解决这个问题吗?先谢了:)

PHP中文网PHP中文网2773 Il y a quelques jours729

répondre à tous(3)je répondrai

  • 天蓬老师

    天蓬老师2017-04-17 17:18:12

    楼主说的Cordova就是之前的PhoneGap吧?

    répondre
    0
  • PHP中文网

    PHP中文网2017-04-17 17:18:12

    似乎是ALBBLoginSDK.frameworkALBBTradeSDK.framework中同时含有Info.plist项目名-Info.plist,而且内容不一致,而其他framework文件中就只有Info.plist,把有问题的两个framework里的项目名-Info.plist删掉就可以成功导入,就唤起淘宝app这一功能来说暂时没发现有什么问题……

    répondre
    0
  • 怪我咯

    怪我咯2017-04-17 17:18:12

    嗯,以前写一个蒲公英的cordvoa插件的时候也遇到过类似的,debug了半天发现是解析某个plist文件出错了。结果发现蒲公英SDK里面的info.plist是乱码。。。导致解析失败。
    估计是你那两个framework的plist文件内容有问题。

    répondre
    0
  • Annulerrépondre